UTCTime { @Nonnull public static DateTime parse(@Nonnull final String str) { assert str != null; return DateTime.parse(str).withZone(DateTimeZone.UTC); } private  UTCTime(); @SuppressWarnings("SSBasedInspection") @Nonnull static DateTime now(); @Nonnull static DateTime from(@Nonnull final DateTime time); @Nonnull static DateTime from(@Nonnull final Date time); @Nonnull static DateTime parse(@Nonnull final String str); static int dateTimeToUTCTimestamp(@Nonnull final DateTime dateTime); static final DateTime MIN_TIMESTAMP_DATE; static final DateTime MAX_TIMESTAMP_DATE; }
@Test public void testParse() { LOG.info("testParse"); final DateTime t1 = DateTime.parse("2012-10-04").withZone(DateTimeZone.UTC); final DateTime t2 = UTCTime.parse("2012-10-04"); Assert.assertEquals(t1.getMillis(), t2.getMillis()); }
@Test public void testParseWithTime() { LOG.info("testParseWithTime"); final DateTime t1 = DateTime.parse("2012-10-04T08:15:30").withZone(DateTimeZone.UTC); final DateTime t2 = UTCTime.parse("2012-10-04T08:15:30"); Assert.assertEquals(t1.getMillis(), t2.getMillis()); }
@Test public void testParseWithTimeZone() { LOG.info("testParseWithTimeZone"); final DateTime t1 = DateTime.parse("2012-10-04T08:15:30-05:00").withZone(DateTimeZone.UTC); final DateTime t2 = UTCTime.parse("2012-10-04T08:15:30-05:00"); Assert.assertEquals(t1.getMillis(), t2.getMillis()); }