use of io.questdb.std.datetime.DateFormat in project questdb by bluestreak01.
the class TimestampFormatCompilerTest method testFormatBSTtoMSK.
@Test
public void testFormatBSTtoMSK() throws Exception {
DateFormat fmt = get("dd-MM-yyyy HH:mm:ss Z");
String targetTimezoneName = "MSK";
long millis = fmt.parse("06-04-2017 01:09:30 BST", defaultLocale);
millis += defaultLocale.getRules(targetTimezoneName, RESOLUTION_MICROS).getOffset(millis);
sink.clear();
fmt.format(millis, defaultLocale, targetTimezoneName, sink);
TestUtils.assertEquals("06-04-2017 03:09:30 MSK", sink);
// assertThat("dd-MM-yyyy HH:mm:ss Z", "06-04-2017 03:09:30 MSK", "06-04-2017 01:09:30 BST");
}
use of io.questdb.std.datetime.DateFormat in project questdb by bluestreak01.
the class TimestampFormatCompilerTest method testNegativeYear.
@Test
public void testNegativeYear() throws Exception {
assertThat("yyyy MMM dd", "-2010-09-01T00:00:00.000Z", "-2010 Sep 01");
DateFormat fmt1 = compiler.compile("G yyyy MMM", true);
DateFormat fmt2 = compiler.compile("yyyy MMM dd", true);
long millis = fmt2.parse("-2010 Sep 01", defaultLocale);
sink.clear();
fmt1.format(millis, defaultLocale, "Z", sink);
TestUtils.assertEquals("BC -2010 Sep", sink);
}
use of io.questdb.std.datetime.DateFormat in project questdb by bluestreak01.
the class DateFormatCompilerTest method testNegativeYear.
@Test
public void testNegativeYear() throws Exception {
assertThat("yyyy MMM dd", "-2010-09-01T00:00:00.000Z", "-2010 Sep 01");
DateFormat fmt1 = compiler.compile("G yyyy MMM", true);
DateFormat fmt2 = compiler.compile("yyyy MMM dd", true);
long millis = fmt2.parse("-2010 Sep 01", defaultLocale);
sink.clear();
fmt1.format(millis, defaultLocale, "Z", sink);
TestUtils.assertEquals("BC -2010 Sep", sink);
}
Aggregations