Java Code Examples for org.apache.calcite.util.TimestampString#toString()

The following examples show how to use org.apache.calcite.util.TimestampString#toString() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Bats   File: SqlTimestampLiteral.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns e.g. '03:05:67.456'.
 */
public String toFormattedString() {
  TimestampString ts = getTimestamp();
  if (precision > 0) {
    ts = ts.round(precision);
  }
  return ts.toString(precision);
}
 
Example 2
Source Project: flink   File: TimestampStringUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static LocalDateTime toLocalDateTime(TimestampString timestampString) {
	final String v = timestampString.toString();
	final int year = Integer.valueOf(v.substring(0, 4));
	final int month = Integer.valueOf(v.substring(5, 7));
	final int day = Integer.valueOf(v.substring(8, 10));
	final int h = Integer.valueOf(v.substring(11, 13));
	final int m = Integer.valueOf(v.substring(14, 16));
	final int s = Integer.valueOf(v.substring(17, 19));
	final int nano = getNanosInSecond(v);
	return LocalDateTime.of(year, month, day, h, m, s, nano);
}
 
Example 3
Source Project: calcite   File: SqlTimestampLiteral.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns e.g. '03:05:67.456'.
 */
public String toFormattedString() {
  TimestampString ts = getTimestamp();
  if (precision > 0) {
    ts = ts.round(precision);
  }
  return ts.toString(precision);
}