java - Using Joda DateTime on the backend, how do I convert to a JavaScript Date object? - Stack Overflow

I'm using the Joda DateTime object (per SO remendations) heavily on the Java back-end of my applic

I'm using the Joda DateTime object (per SO remendations) heavily on the Java back-end of my application. But I've not figured out a very consistent way to go back and forth to JavaScript. The Date object described by MDN seems to indicate that "IETF-pliant RFC 1123 timestamps" are a standard format, but my searches didn't seem to turn up a formatter built into the Joda library to get my DateTime object in that format.

Is there a simple method I can invoke to convert a DateTime object to a format consumable by my web-client? Will it support IE8 (in terms of JavaScript)?

*Note: I'm not using Spring or anything that does automatic binding (serialization/deserialization) and it's not an option at this point. I know, I know...

I'm using the Joda DateTime object (per SO remendations) heavily on the Java back-end of my application. But I've not figured out a very consistent way to go back and forth to JavaScript. The Date object described by MDN seems to indicate that "IETF-pliant RFC 1123 timestamps" are a standard format, but my searches didn't seem to turn up a formatter built into the Joda library to get my DateTime object in that format.

Is there a simple method I can invoke to convert a DateTime object to a format consumable by my web-client? Will it support IE8 (in terms of JavaScript)?

*Note: I'm not using Spring or anything that does automatic binding (serialization/deserialization) and it's not an option at this point. I know, I know...

Share Improve this question edited Oct 7, 2021 at 5:51 CommunityBot 11 silver badge asked Sep 19, 2011 at 13:07 blongblong 2,7038 gold badges47 silver badges114 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 6

The easiest solution is to use the miliseconds since epoch version of the javascript Date constructor. For the conversion you can use DateTimeUtils.getInstantMillis(ReadableInstant instant).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745347530a4623628.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信