Java Code Examples for org.apache.calcite.avatica.util.DateTimeUtils#MILLIS_PER_SECOND

The following examples show how to use org.apache.calcite.avatica.util.DateTimeUtils#MILLIS_PER_SECOND . 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 File: TimestampString.java    From Quicksql with MIT License 6 votes vote down vote up
/** Returns the number of milliseconds since the epoch. */
public long getMillisSinceEpoch() {
  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 ms = getMillisInSecond();
  final int d = DateTimeUtils.ymdToUnixDate(year, month, day);
  return d * DateTimeUtils.MILLIS_PER_DAY
      + h * DateTimeUtils.MILLIS_PER_HOUR
      + m * DateTimeUtils.MILLIS_PER_MINUTE
      + s * DateTimeUtils.MILLIS_PER_SECOND
      + ms;
}
 
Example 2
Source File: TimestampString.java    From calcite with Apache License 2.0 6 votes vote down vote up
/** Returns the number of milliseconds since the epoch. */
public long getMillisSinceEpoch() {
  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 ms = getMillisInSecond();
  final int d = DateTimeUtils.ymdToUnixDate(year, month, day);
  return d * DateTimeUtils.MILLIS_PER_DAY
      + h * DateTimeUtils.MILLIS_PER_HOUR
      + m * DateTimeUtils.MILLIS_PER_MINUTE
      + s * DateTimeUtils.MILLIS_PER_SECOND
      + ms;
}
 
Example 3
Source File: TimeString.java    From Quicksql with MIT License 5 votes vote down vote up
public int getMillisOfDay() {
  int h = Integer.valueOf(v.substring(0, 2));
  int m = Integer.valueOf(v.substring(3, 5));
  int s = Integer.valueOf(v.substring(6, 8));
  int ms = getMillisInSecond();
  return (int) (h * DateTimeUtils.MILLIS_PER_HOUR
      + m * DateTimeUtils.MILLIS_PER_MINUTE
      + s * DateTimeUtils.MILLIS_PER_SECOND
      + ms);
}
 
Example 4
Source File: TimeString.java    From calcite with Apache License 2.0 5 votes vote down vote up
public int getMillisOfDay() {
  int h = Integer.valueOf(v.substring(0, 2));
  int m = Integer.valueOf(v.substring(3, 5));
  int s = Integer.valueOf(v.substring(6, 8));
  int ms = getMillisInSecond();
  return (int) (h * DateTimeUtils.MILLIS_PER_HOUR
      + m * DateTimeUtils.MILLIS_PER_MINUTE
      + s * DateTimeUtils.MILLIS_PER_SECOND
      + ms);
}