public DateTimeParser(Map<String, String> properties) { super(properties); tsPattern = properties.get(StreamingParser.PROPERTY_TS_PATTERN); try { formatter = org.apache.kylin.common.util.DateFormat.getDateFormat(tsPattern); } catch (Throwable e) { throw new IllegalStateException("Invalid tsPattern: '" + tsPattern + "'."); } }
public static Date stringToDate(String str, String pattern) { Date date = null; try { date = getDateFormat(pattern).parse(str); } catch (ParseException e) { throw new IllegalArgumentException("'" + str + "' is not a valid date of pattern '" + pattern + "'", e); } return date; }
public static String formatToTimeStr(long millis, String pattern) { return getDateFormat(pattern).format(new Date(millis)); }
public static String formatToDateStr(long millis, String pattern) { return getDateFormat(pattern).format(new Date(millis)); }
public static String dateToString(Date date, String pattern) { return getDateFormat(pattern).format(date); }
@Test @Ignore("for dev only") public void test3() throws Exception { FastDateFormat formatter = org.apache.kylin.common.util.DateFormat.getDateFormat("MMM dd, yyyy hh:mm:ss aa"); System.out.println(formatter.format(new Date())); String timeStr = "Jul 20, 2016 9:59:17 AM"; System.out.println(formatter.parse(timeStr).getTime()); }
public static String dateToString(Date date, String pattern) { return getDateFormat(pattern).format(date); }
public static Date stringToDate(String str, String pattern) { Date date = null; try { date = getDateFormat(pattern).parse(str); } catch (ParseException e) { throw new IllegalArgumentException("'" + str + "' is not a valid date of pattern '" + pattern + "'", e); } return date; }
public DateTimeParser(Map<String, String> properties) { super(properties); tsPattern = properties.get(StreamingParser.PROPERTY_TS_PATTERN); try { formatter = org.apache.kylin.common.util.DateFormat.getDateFormat(tsPattern); } catch (Throwable e) { throw new IllegalStateException("Invalid tsPattern: '" + tsPattern + "'."); } }
public static String formatToTimeStr(long millis) { return getDateFormat(DEFAULT_DATETIME_PATTERN_WITH_MILLISECONDS).format(new Date(millis)); }
public static String formatToDateStr(long millis, String pattern) { return getDateFormat(pattern).format(new Date(millis)); }
public static Date stringToDate(String str, String pattern) { Date date = null; try { date = getDateFormat(pattern).parse(str); } catch (ParseException e) { throw new IllegalArgumentException("'" + str + "' is not a valid date of pattern '" + pattern + "'", e); } return date; }
public static String formatToDateStr(long millis, String pattern) { return getDateFormat(pattern).format(new Date(millis)); }
public static String formatToTimeStr(long millis, String pattern) { return getDateFormat(pattern).format(new Date(millis)); }
public static String dateToString(Date date, String pattern) { return getDateFormat(pattern).format(date); }