Firebird 2.1 TIMESTAMP 算术和民用间隔
我的理解是,与 Interbase v6 保持一致,Firebird 2.5 不支持 SQL-92 INTERVAL 关键字。至少,建议此参考和我重复的SQLCODE -尝试让 INTERVAL
在 Firebird 的 isql(1) 下工作时出现 104 错误。
那么,在执行<时,我该如何解释我们民间时间计算中的不规则之处——月份并不统一长,储蓄时间和跳跃调整的日子也不统一,更不用说混乱的年份等了。 Firebird 2.1 下的 code>TIMESTAMP 算术?
如何轻松确定比给定TIMESTAMP
“早一个月”或“晚一周”? “一天后”或“两小时前”怎么样?
My understanding is that, in keeping with Interbase v6, Firebird 2.5 does not support the SQL-92 INTERVAL
keyword. At least, so suggests this reference and my repeated SQLCODE -104 errors trying to get INTERVAL
s to work under Firebird's isql(1).
How, then, do I account for the irregularities in our civil reckoning of time -- months aren't uniformly long, nor are days with savings time and leap adjustments, not to mention the year of confusion, etc. -- when performing TIMESTAMP
arithmetic under Firebird 2.1?
How can I easily determine "one month earlier" or "one week later" than a given TIMESTAMP
? How about "one day later" or "two hours before"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用 DateAdd() 和 DateDiff() 内置函数。
或者,您也可以使用经典的日期算术。
You may use the DateAdd() and DateDiff() built-in functions.
Alternatively you may also use classic date arithmetic.
如果这没有在 Firebird 中实现,也许您可以通过调用 sql 服务器的技术来实现,并获取结果时间戳?我知道用 Java 或 .Net 可以很容易地完成
If this isn't implemented in Firebird, maybe you could do it through the technology calling your sql server, and get the resulting timestamp ? I know it can be quite easily done in Java or .Net
您还可以使用外部 UDF fbudf.dll 的函数
You can also use the functions of the external UDF fbudf.dll
有一个很好的外部 UDF,名为 rFunc:http://rfunc.sourceforge.net/,它有很好的日期DaysBetween 和 IncDate(d, i1, i2, i3) 等函数
There is a nice external UDF named rFunc: http://rfunc.sourceforge.net/, it has nice Date functions like DaysBetween and IncDate(d, i1, i2, i3) and many more