如何将(Jython 的)日期时间类型转换为 java.util.Date?
我是 Jython 新手,如何将(Jython 的)日期时间类型转换为 java.util.Date?
谢谢。
I am new to Jython, how do you convert a datetime type (of Jython) to java.util.Date?
thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请注意这一点:
来自 Jython 的 常见问题解答
Be aware of this:
From Jython's FAQ
这是我的解决方案:
Here is my solution:
我做了一些混乱和试验...这两种方法是我使用的方法,用于转换为 java.sql.Timestamp ,然后在另一个方向上,使用 java.sql.Timestamp.time() (ms自 1970 年 1 月 1 日起)。
这里的“bst”代表英国夏令时间...我当时确实验证了它是否正确考虑了这些日期:即,tz 模块似乎足够聪明,能够检测到夏季期间的月份到 BST 并进行相应调整。
希望它能够与您可以使用的任何其他时区一起使用......
I did a bit of messing around and experimenting with this... these two methods are the ones I use, for conversion to java.sql.Timestamp and then in the other direction, using java.sql.Timestamp.time() (ms since 1/1/1970).
"bst" here stands for British Summer Time... I did at the time verify that it correctly took such dates into account: i.e. it would appear that the tz module is sufficiently clever to be able to detect that months during the summer are subject to BST and adjust accordingly.
Hopefully it should work with any other time zones you can throw at it...