Firebird 2.1 TIMESTAMP 算术和民用间隔

发布于 2024-08-19 01:40:07 字数 465 浏览 7 评论 0原文

我的理解是,与 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 INTERVALs 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

秋千易 2024-08-26 01:40:07

您可以使用 DateAdd()DateDiff() 内置函数。
或者,您也可以使用经典的日期算术

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

你曾走过我的故事 2024-08-26 01:40:07

如果这没有在 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

梦幻之岛 2024-08-26 01:40:07

您还可以使用外部 UDF fbudf.dll 的函数

You can also use the functions of the external UDF fbudf.dll

哎呦我呸! 2024-08-26 01:40:07

有一个很好的外部 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

硪扪都還晓 2024-08-26 01:40:07
  1. 循环中从时间戳日期减去一天,直到月份发生变化。
  2. 循环中从时间戳日期减去一天,直到日期更改为星期日。
  1. Subtract one day from timestamp date in a loop until month has changed.
  2. Subtract one day from timestamp date in a loop until day has changed to SUNDAY.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文