Subject | Re: [firebird-support] Add 1 minute to a TimeStamp |
---|---|
Author | Softtech Support |
Post date | 2015-03-10T20:17:42Z |
Turns out that firebird uses the precision of the used decimal, so
instead of (1.0/24.0) I used (1.0000/24.0)
Here is a version that works
correctly:
DECLARE VARIABLE tsTranCreateDate
TimeStamp;
DECLARE VARIABLE tsTest TimeStamp;
DECLARE VARIABLE tsTest TimeStamp;
Starting Value:
tsTranCreateDate = 10/31/2012 7:50:16
AM
Two days:
tsTest = (:tsTranCreateDate - (2.0));
tsTest = (:tsTranCreateDate - (2.0));
Correctly returns 10/29/2012 7:50:16
AM
One hour:
tsTest = (:tsTranCreateDate -
(1.00000/24.0));
Correctly returns 10/31/2012 6:50:16
AM
One minute:
tsTest = (:tsTranCreateDate -
(1.00000/1440.0));
Correctly returns 10/31/2012 7:49:16
AM
One second:
tsTest = (:tsTranCreateDate -
(1.00000/86400.0));
Incorrectly returns 10/31/2012 7:50:15
AM
Mike
----- Original Message -----Sent: Tuesday, March 10, 2015 3:02 PMSubject: Re: [firebird-support] Add 1 minute to a TimeStamp
In the code provided below I meant to type 2012 not 201----- Original Message -----Sent: Tuesday, March 10, 2015 3:01 PMSubject: Re: [firebird-support] Add 1 minute to a TimeStamp
Firebird v1.5.3Does anyone know what's going on here?DECLARE VARIABLE tsTranCreateDate TimeStamp;
DECLARE VARIABLE tsTest TimeStamp;Starting Value:tsTranCreateDate = 10/31/201 7:50:16 AMTwo days:
tsTest = (:tsTranCreateDate - (2.0));Correctly returns 10/29/201 7:50:16 AMOne hour:tsTest = (:tsTranCreateDate - (1.0/24.0));Incorrectly returns 10/31/201 6:52:40 AMOne minute:tsTest = (:tsTranCreateDate - (1.0/1440.0));Incorrectly returns 10/31/201 7:50:16 AMOne second:tsTest = (:tsTranCreateDate - (1.0/86400.0));
Incorrectly returns 10/31/201 7:50:16 AMSubtract 2 days works fine. Subtract 1 hour is wrong. Subtract one minute or 1 second does nothingAny ideas?Mike----- Original Message -----To: Firebird SupportSent: Tuesday, March 10, 2015 2:22 PMSubject: [firebird-support] Add 1 minute to a TimeStamp
Greetings All,What is the best way in a stored procedure to add a minute or a few seconds to a TimeStamp?Thanks,Mike
This email has been checked for viruses by Avast antivirus software.
www.avast.com
This email has been checked for viruses by Avast antivirus software.
www.avast.com
This email has been checked for viruses by Avast antivirus software.
www.avast.com
This email has been checked for viruses by Avast antivirus software.
www.avast.com