Firebird 2.1 TIMESTAMP arithmetic and civil intervals

I understand that according to Interbase v6, Firebird 2.5 does not support the SQL-92 keyword INTERVAL. At least, this link suggests and my repeated errors SQLCODE -104, trying to get INTERVALisql (1) to work in Firebird.

How do I explain the violations in our civilian time calculation - the months are uneven and are not days with time savings and jump adjustments, not to mention the year of confusion, etc. when doing TIMESTAMParithmetic in Firebird 2.1?

How can I easily define “a month ago” or “in a week” than this TIMESTAMP? How about the next day or two hours before?

+3
source share
5 answers

You can use DateAdd () and DateDiff () built-in functions.
Alternatively, you can also use classic date arithmetic .

+5
source

If this is not implemented in Firebird, perhaps you could do this using the technology calling your sql server and get the final timestamp? I know this can be easily done in Java or .Net

+1
source

UDF fbudf.dll

+1

There is a good external UDF called rFunc: http://rfunc.sourceforge.net/ , it has good Date functions like DaysBetween and IncDate (d, i1, i2, i3) and many others

+1
source
  • Subtract one day from the date of the time stamp in the loop until the month changes.
  • Cross out one day from the date of the time stamp in the cycle until the day changes to SUNDAY.
0
source

Source: https://habr.com/ru/post/1729620/


All Articles