I'm using the Joda DateTime object (per SO recommendations) 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-compliant 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...
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)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With