Is it possible to change the base millisecond reference time from 1970 to 2008 in Java (like JSR-310)

I want to be able to change the base millisecond reference from 1970 to 2008 in Java so that I can save space in the database and unique Ids. Preferably with Joda-Time. The upcoming jsr-310 in the supposed Java 7 release implements it. In the *The Discrete Timeline* section of this link it states that the counting of milliseconds has changed from 1970 to 2008 [http://today.java.net/pub/a/today/2008/09/18/jsr-310-new-java-date-time-api.html][1] --- The only other option I can see is to mathematically implement it every time I need to look up a record. E.g. DateTime dt = new DateTime(); long now = dt.getMillis(); DateTime dt2 = new DateTime(2008, 1, 1, 0, 0, 0, 0); long then = dt2.getMillis(); long smallerDate = now - then; Smaller date will be stored in the DB -- **Edit** -- So I misread the JSR-310, and it's not possible. There are better ways to save space and then a headache of processing thousands of request to calculate longs. I wanted to record longs as dates because I'll never know where I will move the DB to, perhaps MySQL => Oracle. So I didn't want timestamps, I just wanted BigInts. [1]: http://today.java.net/pub/a/today/2008/09/18/jsr-310-new-java-date-time-api.html
How is this supposed to save space in the DB? Sure, that text representation of the long value would be slightly shorter, but if you declare the column to be of type bigint (or similar, as you have to in order to store the value), it take the same size regardless of the beginning of the epoch.

以上就是Is it possible to change the base millisecond reference time from 1970 to 2008 in Java (like JSR-310)的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏