Subject | Re: [firebird-support] Add 1 minute to a TimeSta mp |
---|---|
Author | Mark Rotteveel |
Post date | 2015-03-10T20:25:14Z |
Decimal literals are numeric, not floating point. 1.0 / 24.0 is numeric(18,2) so the value is 0.04 and not 0.041666...
You need a double value, so use 1E0/24.
To answer your original question: in more recent versions of Firebird you can use DATEADD.
Mark
----- Reply message -----
Van: "'Softtech Support' stwizard@... [firebird-support]" <firebird-support@yahoogroups.com>
Aan: <firebird-support@yahoogroups.com>
Onderwerp: [firebird-support] Add 1 minute to a TimeStamp
Datum: di, mrt. 10, 2015 21:01
Van: "'Softtech Support' stwizard@... [firebird-support]" <firebird-support@yahoogroups.com>
Aan: <firebird-support@yahoogroups.com>
Onderwerp: [firebird-support] Add 1 minute to a TimeStamp
Datum: di, mrt. 10, 2015 21:01
Firebird v1.5.3
Does anyone know what's going on here?
DECLARE VARIABLE tsTranCreateDate
TimeStamp;
DECLARE VARIABLE tsTest TimeStamp;
DECLARE VARIABLE tsTest TimeStamp;
Starting Value:
tsTranCreateDate = 10/31/201 7:50:16
AM
Two days:
tsTest = (:tsTranCreateDate - (2.0));
tsTest = (:tsTranCreateDate - (2.0));
Correctly returns 10/29/201 7:50:16 AM
One hour:
tsTest = (:tsTranCreateDate -
(1.0/24.0));
Incorrectly returns 10/31/201 6:52:40
AM
One minute:
tsTest = (:tsTranCreateDate -
(1.0/1440.0));
Incorrectly returns 10/31/201 7:50:16
AM
One second:
tsTest = (:tsTranCreateDate - (1.0/86400.0));
Incorrectly returns 10/31/201 7:50:16
AM
Subtract 2 days works fine. Subtract 1 hour is wrong. Subtract
one minute or 1 second does nothing
Any 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