java - Joda - Print DateTime ignoring TimeZones -
i got 2 timestamps:
2015-03-30t00:36:00.000+0100
2015-03-30t00:36:00.000+0200
only timezone differs. after parsing timestamp datetimeformatter
, printing time (without date) using datetimeformat.shorttime()
. results are:
- 00:36
- 23:36
since times matter in case ignore timezones when printing time. how can achieve printing 00:36 both timestamps?
you use fixed-length-format can this:
localdatetime ldt = localdatetime.parse(input, isodatetimeformat.datetimeparser()); system.out.println(ldt.tolocaltime().tostring(isodatetimeformat.hourminute())); // output: 00:36
i use localdatetime
because not interested in timezone offset.
Comments
Post a Comment