Blackberry JDE 和 Sqlite 时间戳

发布于 2024-09-10 04:59:38 字数 143 浏览 0 评论 0原文

我试图将 DateField 中的日期存储到 sqlite 数据库中,但无法弄清楚以什么格式存储/检索它以保留该值。我一直在尝试将 sqlite 数据类型用作“时间戳”并在应用程序中使用“长”。当我检索日期时,它变成了 1970 年而不是 2010 年左右。有什么建议吗?

I am trying to store a date from a DateField into an sqlite database, but can't figure out what format to store/retrieve it in to preserve the value. I have been trying with the sqlite datatype as 'timestamp' and using 'long' in the application. When I retrieve the date though, it goes to 1970 instead of 2010-ish. Any recommendations?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

清眉祭 2024-09-17 04:59:38

如果其他人遇到问题,这种方法确实有效。在数据库中使用时间戳,在应用程序中使用 long。我的问题是我不小心将值读入 int 中,并且它正在环绕。读入很长的内容就会使它起作用。

If anyone else was having a problem, this approach does work. Use timestamp in the database and long in your app. My problem was I was reading in the value into an int by accident and it was wrapping around. Reading into a long will make it work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文