org.h2.util

## Class DateTimeUtils

- java.lang.Object
- - org.h2.util.DateTimeUtils

    public class DateTimeUtils
    extends java.lang.Object

This utility class contains time conversion functions.

Date value: a bit field with bits for the year, month, and day. Absolute day: the day number (0 means 1970-01-01).

### Field Summary

Fields
`static int` `EPOCH_DATE_VALUE` Date value for 1970-01-01.
`static long` `MILLIS_PER_DAY` The number of milliseconds per day.
`static long` `NANOS_PER_DAY` The number of nanoseconds per day.
`static long` `NANOS_PER_HOUR` The number of nanoseconds per hour.
`static long` `NANOS_PER_MINUTE` The number of nanoseconds per minute.
`static long` `NANOS_PER_SECOND` The number of nanoseconds per second.
`static long` `SECONDS_PER_DAY` The number of seconds per day.
`static java.util.TimeZone` `UTC` UTC time zone.

### Method Summary

Methods
`static long` `absoluteDayFromDateValue(long dateValue)` Calculate the absolute day from an encoded date value.
`static long` `absoluteDayFromYear(long year)` Calculate the absolute day for a January, 1 of the specified year.
`static void` `appendDate(java.lang.StringBuilder buff, long dateValue)` Append a date to the string builder.
`static void` `appendTime(java.lang.StringBuilder buff, long nanos)` Append a time to the string builder.
`static void` `appendTimestampTimeZone(java.lang.StringBuilder buff, long dateValue, long timeNanos, short timeZoneOffsetMins)` Formats timestamp with time zone as string.
`static void` `appendTimeZone(java.lang.StringBuilder buff, short tz)` Append a time zone to the string builder.
`static ValueDate` `convertDate(java.sql.Date x, java.util.Calendar calendar)` Convert a java.util.Date using the specified calendar.
`static java.sql.Date` `convertDate(Value value, java.util.Calendar calendar)` Convert the date to the specified time zone.
`static long` `convertDateTimeValueToMillis(java.util.TimeZone tz, long dateValue, long ms)` Convert an encoded date-time value to millis, using the supplied timezone.
`static java.sql.Date` `convertDateValueToDate(long dateValue)` Convert an encoded date value to a java.util.Date, using the default timezone.
`static java.sql.Timestamp` `convertDateValueToTimestamp(long dateValue, long timeNanos)` Convert an encoded date value / time value to a timestamp, using the default timezone.
`static java.sql.Time` `convertNanoToTime(long nanosSinceMidnight)` Convert a time value to a time, using the default timezone.
`static long` `convertScale(long nanosOfDay, int scale)` Converts scale of nanoseconds.
`static ValueTime` `convertTime(java.sql.Time x, java.util.Calendar calendar)` Convert the time using the specified calendar.
`static java.sql.Time` `convertTime(Value value, java.util.Calendar calendar)` Convert the time to the specified time zone.
`static ValueTimestamp` `convertTimestamp(java.sql.Timestamp x, java.util.Calendar calendar)` Convert the timestamp using the specified calendar.
`static java.sql.Timestamp` `convertTimestamp(Value value, java.util.Calendar calendar)` Convert the timestamp to the specified time zone.
`static java.sql.Timestamp` `convertTimestampTimeZoneToTimestamp(long dateValue, long timeNanos, short offsetMins)` Convert an encoded date value / time value to a timestamp using the specified time zone offset.
`static java.util.GregorianCalendar` `createGregorianCalendar()` Creates a Gregorian calendar for the default timezone using the default locale.
`static java.util.GregorianCalendar` `createGregorianCalendar(java.util.TimeZone tz)` Creates a Gregorian calendar for the given timezone using the default locale.
`static long[]` `dateAndTimeFromValue(Value value)` Extracts date value and nanos of day from the specified value.
`static Value` `dateTimeToValue(Value original, long dateValue, long timeNanos, boolean forceTimestamp)` Creates a new date-time value with the same type as original value.
`static long` `dateValue(long year, int month, int day)` Get the date value from a given date.
`static long` `dateValueFromAbsoluteDay(long absoluteDay)` Calculate the encoded date value from an absolute day.
`static long` `dateValueFromDenormalizedDate(long year, long month, int day)` Get the date value from a given denormalized date with possible out of range values of month and/or day.
`static long` `dateValueFromLocalMillis(long ms)` Convert a local datetime in millis to an encoded date.
`static int` `dayFromDateValue(long x)` Get the day of month from a date value.
`static long` `decrementDateValue(long dateValue)` Return the previous date value.
`static java.util.GregorianCalendar` `getCalendar()` Get a calendar for the default timezone.
`static int` `getDayOfWeek(long dateValue, int firstDayOfWeek)` Returns day of week.
`static int` `getDayOfWeekFromAbsolute(long absoluteValue, int firstDayOfWeek)` Get the day of the week from the absolute day value.
`static int` `getDayOfYear(long dateValue)` Returns number of day in year.
`static int` `getDaysInMonth(int year, int month)` Returns number of days in month.
`static int` `getIsoDayOfWeek(long dateValue)` Returns ISO day of week.
`static int` `getIsoWeekOfYear(long dateValue)` Returns ISO number of week in year.
`static int` `getIsoWeekYear(long dateValue)` Returns ISO week year.
`static long` `getMillis(long dateValue, long timeNanos, short offsetMins)` Calculates the milliseconds since epoch for the specified date value, nanoseconds since midnight, and time zone offset.
`static long` `getMillis(java.util.TimeZone tz, int year, int month, int day, int hour, int minute, int second, int millis)` Calculate the milliseconds since 1970-01-01 (UTC) for the given date and time (in the specified timezone).
`static int` `getSundayDayOfWeek(long dateValue)` Returns day of week with Sunday as 1.
`static long` `getTimeLocalWithoutDst(java.util.Date d)` Get the number of milliseconds since 1970-01-01 in the local timezone, but without daylight saving time into account.
`static long` `getTimeUTCWithoutDst(long millis)` Convert the number of milliseconds since 1970-01-01 in the local timezone to UTC, but without daylight saving time into account.
`static int` `getTimeZoneOffset(long ms)` Returns local time zone offset for a specified timestamp.
`static int` `getTimeZoneOffsetMillis(java.util.TimeZone tz, long dateValue, long timeNanos)` Calculates the time zone offset in minutes for the specified time zone, date value, and nanoseconds since midnight.
`static int` `getWeekOfYear(long dateValue, int firstDayOfWeek, int minimalDaysInFirstWeek)` Returns number of week in year.
`static int` `getWeekYear(long dateValue, int firstDayOfWeek, int minimalDaysInFirstWeek)` Returns week year.
`static long` `incrementDateValue(long dateValue)` Return the next date value.
`static boolean` `isValidDate(int year, int month, int day)` Verify if the specified date is valid.
`static int` `monthFromDateValue(long x)` Get the month from a date value.
`static long` `nanosFromLocalMillis(long ms)` Convert a time in milliseconds in local time to the nanoseconds since midnight.
`static ValueTimestamp` `normalizeTimestamp(long absoluteDay, long nanos)` Calculate the normalized timestamp.
`static long` `parseDateValue(java.lang.String s, int start, int end)` Parse a date string.
`static long` `parseTimeNanos(java.lang.String s, int start, int end)` Parse a time string.
`static Value` `parseTimestamp(java.lang.String s, Mode mode, boolean withTimeZone)` Parses timestamp value from the specified string.
`static long` `prolepticGregorianAbsoluteDayFromDateValue(long dateValue)` Calculate the absolute day from an encoded date value in proleptic Gregorian calendar.
`static void` `resetCalendar()` Reset the cached calendar for default timezone, for example after changing the default timezone.
`static ValueTimestampTimeZone` `timestampTimeZoneFromLocalDateValueAndNanos(long dateValue, long timeNanos)` Converts local date value and nanoseconds to timestamp with time zone.
`static ValueTimestampTimeZone` `timestampTimeZoneFromMillis(long ms)` Creates the instance of the `ValueTimestampTimeZone` from milliseconds.
`static java.lang.String` `timeZoneNameFromOffsetMins(int offsetMins)` Generates time zone name for the specified offset in minutes.
`static int` `yearFromDateValue(long x)` Get the year from a date value.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### MILLIS_PER_DAY

    public static final long MILLIS_PER_DAY

The number of milliseconds per day.

See Also:
  Constant Field Values

#### SECONDS_PER_DAY

    public static final long SECONDS_PER_DAY

The number of seconds per day.

See Also:
  Constant Field Values

#### UTC

    public static final java.util.TimeZone UTC

UTC time zone.

#### NANOS_PER_SECOND

    public static final long NANOS_PER_SECOND

The number of nanoseconds per second.

See Also:
  Constant Field Values

#### NANOS_PER_MINUTE

    public static final long NANOS_PER_MINUTE

The number of nanoseconds per minute.

See Also:
  Constant Field Values

#### NANOS_PER_HOUR

    public static final long NANOS_PER_HOUR

The number of nanoseconds per hour.

See Also:
  Constant Field Values

#### NANOS_PER_DAY

    public static final long NANOS_PER_DAY

The number of nanoseconds per day.

See Also:
  Constant Field Values

#### EPOCH_DATE_VALUE

    public static final int EPOCH_DATE_VALUE

Date value for 1970-01-01.

See Also:
  Constant Field Values

### Method Detail

#### getTimeZoneOffset

    public static int getTimeZoneOffset(long ms)

Returns local time zone offset for a specified timestamp.

Parameters:
  `ms` - milliseconds since Epoch in UTC
Returns:
  local time zone offset

#### resetCalendar

    public static void resetCalendar()

Reset the cached calendar for default timezone, for example after changing the default timezone.

#### getCalendar

    public static java.util.GregorianCalendar getCalendar()

Get a calendar for the default timezone.

Returns:
  a calendar instance. A cached instance is returned where possible

#### createGregorianCalendar

    public static java.util.GregorianCalendar createGregorianCalendar()

Creates a Gregorian calendar for the default timezone using the default locale. Dates in H2 are represented in a Gregorian calendar. So this method should be used instead of Calendar.getInstance() to ensure that the Gregorian calendar is used for all date processing instead of a default locale calendar that can be non-Gregorian in some locales.

Returns:
  a new calendar instance.

#### createGregorianCalendar

    public static java.util.GregorianCalendar createGregorianCalendar(java.util.TimeZone tz)

Creates a Gregorian calendar for the given timezone using the default locale. Dates in H2 are represented in a Gregorian calendar. So this method should be used instead of Calendar.getInstance() to ensure that the Gregorian calendar is used for all date processing instead of a default locale calendar that can be non-Gregorian in some locales.

Parameters:
  `tz` - timezone for the calendar, is never null
Returns:
  a new calendar instance.

#### convertDate

    public static java.sql.Date convertDate(Value value,
                            java.util.Calendar calendar)

Convert the date to the specified time zone.

Parameters:
  `value` - the date (might be ValueNull)
  `calendar` - the calendar
Returns:
  the date using the correct time zone

#### convertTime

    public static java.sql.Time convertTime(Value value,
                            java.util.Calendar calendar)

Convert the time to the specified time zone.

Parameters:
  `value` - the time (might be ValueNull)
  `calendar` - the calendar
Returns:
  the time using the correct time zone

#### convertTimestamp

    public static java.sql.Timestamp convertTimestamp(Value value,
                                      java.util.Calendar calendar)

Convert the timestamp to the specified time zone.

Parameters:
  `value` - the timestamp (might be ValueNull)
  `calendar` - the calendar
Returns:
  the timestamp using the correct time zone

#### convertDate

    public static ValueDate convertDate(java.sql.Date x,
                        java.util.Calendar calendar)

Convert a java.util.Date using the specified calendar.

Parameters:
  `x` - the date
  `calendar` - the calendar
Returns:
  the date

#### convertTime

    public static ValueTime convertTime(java.sql.Time x,
                        java.util.Calendar calendar)

Convert the time using the specified calendar.

Parameters:
  `x` - the time
  `calendar` - the calendar
Returns:
  the time

#### convertTimestamp

    public static ValueTimestamp convertTimestamp(java.sql.Timestamp x,
                                  java.util.Calendar calendar)

Convert the timestamp using the specified calendar.

Parameters:
  `x` - the time
  `calendar` - the calendar
Returns:
  the timestamp

#### parseDateValue

    public static long parseDateValue(java.lang.String s,
                      int start,
                      int end)

Parse a date string. The format is: [+|-]year-month-day or [+|-]yyyyMMdd.

Parameters:
  `s` - the string to parse
  `start` - the parse index start
  `end` - the parse index end
Returns:
  the date value
Throws:
  `java.lang.IllegalArgumentException` - if there is a problem

#### parseTimeNanos

    public static long parseTimeNanos(java.lang.String s,
                      int start,
                      int end)

Parse a time string. The format is: hour:minute[:second[.nanos]], hhmm[ss[.nanos]], or hour.minute.second[.nanos].

Parameters:
  `s` - the string to parse
  `start` - the parse index start
  `end` - the parse index end
Returns:
  the time in nanoseconds
Throws:
  `java.lang.IllegalArgumentException` - if there is a problem

#### parseTimestamp

    public static Value parseTimestamp(java.lang.String s,
                       Mode mode,
                       boolean withTimeZone)

Parses timestamp value from the specified string.

Parameters:
  `s` - string to parse
  `mode` - database mode, or `null`
  `withTimeZone` - if `true` return `ValueTimestampTimeZone` instead of `ValueTimestamp`
Returns:
  parsed timestamp

#### getTimeZoneOffsetMillis

    public static int getTimeZoneOffsetMillis(java.util.TimeZone tz,
                              long dateValue,
                              long timeNanos)

Calculates the time zone offset in minutes for the specified time zone, date value, and nanoseconds since midnight.

Parameters:
  `tz` - time zone, or `null` for default
  `dateValue` - date value
  `timeNanos` - nanoseconds since midnight
Returns:
  time zone offset in milliseconds

#### getMillis

    public static long getMillis(long dateValue,
                 long timeNanos,
                 short offsetMins)

Calculates the milliseconds since epoch for the specified date value, nanoseconds since midnight, and time zone offset.

Parameters:
  `dateValue` - date value
  `timeNanos` - nanoseconds since midnight
  `offsetMins` - time zone offset in minutes
Returns:
  milliseconds since epoch in UTC

#### getMillis

    public static long getMillis(java.util.TimeZone tz,
                 int year,
                 int month,
                 int day,
                 int hour,
                 int minute,
                 int second,
                 int millis)

Calculate the milliseconds since 1970-01-01 (UTC) for the given date and time (in the specified timezone).

Parameters:
  `tz` - the timezone of the parameters, or null for the default timezone
  `year` - the absolute year (positive or negative)
  `month` - the month (1-12)
  `day` - the day (1-31)
  `hour` - the hour (0-23)
  `minute` - the minutes (0-59)
  `second` - the number of seconds (0-59)
  `millis` - the number of milliseconds
Returns:
  the number of milliseconds (UTC)

#### dateAndTimeFromValue

    public static long[] dateAndTimeFromValue(Value value)

Extracts date value and nanos of day from the specified value.

Parameters:
  `value` - value to extract fields from
Returns:
  array with date value and nanos of day

#### dateTimeToValue

    public static Value dateTimeToValue(Value original,
                        long dateValue,
                        long timeNanos,
                        boolean forceTimestamp)

Creates a new date-time value with the same type as original value. If original value is a ValueTimestampTimeZone, returned value will have the same time zone offset as original value.

Parameters:
  `original` - original value
  `dateValue` - date value for the returned value
  `timeNanos` - nanos of day for the returned value
  `forceTimestamp` - if `true` return ValueTimestamp if original argument is ValueDate or ValueTime
Returns:
  new value with specified date value and nanos of day

#### getTimeLocalWithoutDst

    public static long getTimeLocalWithoutDst(java.util.Date d)

Get the number of milliseconds since 1970-01-01 in the local timezone, but without daylight saving time into account.

Parameters:
  `d` - the date
Returns:
  the milliseconds

#### getTimeUTCWithoutDst

    public static long getTimeUTCWithoutDst(long millis)

Convert the number of milliseconds since 1970-01-01 in the local timezone to UTC, but without daylight saving time into account.

Parameters:
  `millis` - the number of milliseconds in the local timezone
Returns:
  the number of milliseconds in UTC

#### getDayOfWeek

    public static int getDayOfWeek(long dateValue,
                   int firstDayOfWeek)

Returns day of week.

Parameters:
  `dateValue` - the date value
  `firstDayOfWeek` - first day of week, Monday as 1, Sunday as 7 or 0
Returns:
  day of week
See Also:
  `getIsoDayOfWeek(long)`

#### getDayOfWeekFromAbsolute

    public static int getDayOfWeekFromAbsolute(long absoluteValue,
                               int firstDayOfWeek)

Get the day of the week from the absolute day value.

Parameters:
  `absoluteValue` - the absolute day
  `firstDayOfWeek` - the first day of the week
Returns:
  the day of week

#### getDayOfYear

    public static int getDayOfYear(long dateValue)

Returns number of day in year.

Parameters:
  `dateValue` - the date value
Returns:
  number of day in year

#### getIsoDayOfWeek

    public static int getIsoDayOfWeek(long dateValue)

Returns ISO day of week.

Parameters:
  `dateValue` - the date value
Returns:
  ISO day of week, Monday as 1 to Sunday as 7
See Also:
  `getSundayDayOfWeek(long)`

#### getIsoWeekOfYear

    public static int getIsoWeekOfYear(long dateValue)

Returns ISO number of week in year.

Parameters:
  `dateValue` - the date value
Returns:
  number of week in year
See Also:
  `getIsoWeekYear(long)`, `getWeekOfYear(long, int, int)`

#### getIsoWeekYear

    public static int getIsoWeekYear(long dateValue)

Returns ISO week year.

Parameters:
  `dateValue` - the date value
Returns:
  ISO week year
See Also:
  `getIsoWeekOfYear(long)`, `getWeekYear(long, int, int)`

#### getSundayDayOfWeek

    public static int getSundayDayOfWeek(long dateValue)

Returns day of week with Sunday as 1.

Parameters:
  `dateValue` - the date value
Returns:
  day of week, Sunday as 1 to Monday as 7
See Also:
  `getIsoDayOfWeek(long)`

#### getWeekOfYear

    public static int getWeekOfYear(long dateValue,
                    int firstDayOfWeek,
                    int minimalDaysInFirstWeek)

Returns number of week in year.

Parameters:
  `dateValue` - the date value
  `firstDayOfWeek` - first day of week, Monday as 1, Sunday as 7 or 0
  `minimalDaysInFirstWeek` - minimal days in first week of year
Returns:
  number of week in year
See Also:
  `getIsoWeekOfYear(long)`

#### getWeekYear

    public static int getWeekYear(long dateValue,
                  int firstDayOfWeek,
                  int minimalDaysInFirstWeek)

Returns week year.

Parameters:
  `dateValue` - the date value
  `firstDayOfWeek` - first day of week, Monday as 1, Sunday as 7 or 0
  `minimalDaysInFirstWeek` - minimal days in first week of year
Returns:
  week year
See Also:
  `getIsoWeekYear(long)`

#### getDaysInMonth

    public static int getDaysInMonth(int year,
                     int month)

Returns number of days in month.

Parameters:
  `year` - the year
  `month` - the month
Returns:
  number of days in the specified month

#### isValidDate

    public static boolean isValidDate(int year,
                      int month,
                      int day)

Verify if the specified date is valid.

Parameters:
  `year` - the year
  `month` - the month (January is 1)
  `day` - the day (1 is the first of the month)
Returns:
  true if it is valid

#### convertDateValueToDate

    public static java.sql.Date convertDateValueToDate(long dateValue)

Convert an encoded date value to a java.util.Date, using the default timezone.

Parameters:
  `dateValue` - the date value
Returns:
  the date

#### convertDateTimeValueToMillis

    public static long convertDateTimeValueToMillis(java.util.TimeZone tz,
                                    long dateValue,
                                    long ms)

Convert an encoded date-time value to millis, using the supplied timezone.

Parameters:
  `tz` - the timezone
  `dateValue` - the date value
  `ms` - milliseconds of day
Returns:
  the date

#### convertDateValueToTimestamp

    public static java.sql.Timestamp convertDateValueToTimestamp(long dateValue,
                                                 long timeNanos)

Convert an encoded date value / time value to a timestamp, using the default timezone.

Parameters:
  `dateValue` - the date value
  `timeNanos` - the nanoseconds since midnight
Returns:
  the timestamp

#### convertTimestampTimeZoneToTimestamp

    public static java.sql.Timestamp convertTimestampTimeZoneToTimestamp(long dateValue,
                                                         long timeNanos,
                                                         short offsetMins)

Convert an encoded date value / time value to a timestamp using the specified time zone offset.

Parameters:
  `dateValue` - the date value
  `timeNanos` - the nanoseconds since midnight
  `offsetMins` - time zone offset in minutes
Returns:
  the timestamp

#### convertNanoToTime

    public static java.sql.Time convertNanoToTime(long nanosSinceMidnight)

Convert a time value to a time, using the default timezone.

Parameters:
  `nanosSinceMidnight` - the nanoseconds since midnight
Returns:
  the time

#### yearFromDateValue

    public static int yearFromDateValue(long x)

Get the year from a date value.

Parameters:
  `x` - the date value
Returns:
  the year

#### monthFromDateValue

    public static int monthFromDateValue(long x)

Get the month from a date value.

Parameters:
  `x` - the date value
Returns:
  the month (1..12)

#### dayFromDateValue

    public static int dayFromDateValue(long x)

Get the day of month from a date value.

Parameters:
  `x` - the date value
Returns:
  the day (1..31)

#### dateValue

    public static long dateValue(long year,
                 int month,
                 int day)

Get the date value from a given date.

Parameters:
  `year` - the year
  `month` - the month (1..12)
  `day` - the day (1..31)
Returns:
  the date value

#### dateValueFromDenormalizedDate

    public static long dateValueFromDenormalizedDate(long year,
                                     long month,
                                     int day)

Get the date value from a given denormalized date with possible out of range values of month and/or day. Used after addition or subtraction month or years to (from) it to get a valid date.

Parameters:
  `year` - the year
  `month` - the month, if out of range month and year will be normalized
  `day` - the day of the month, if out of range it will be saturated
Returns:
  the date value

#### dateValueFromLocalMillis

    public static long dateValueFromLocalMillis(long ms)

Convert a local datetime in millis to an encoded date.

Parameters:
  `ms` - the milliseconds
Returns:
  the date value

#### nanosFromLocalMillis

    public static long nanosFromLocalMillis(long ms)

Convert a time in milliseconds in local time to the nanoseconds since midnight.

Parameters:
  `ms` - the milliseconds
Returns:
  the nanoseconds

#### normalizeTimestamp

    public static ValueTimestamp normalizeTimestamp(long absoluteDay,
                                    long nanos)

Calculate the normalized timestamp.

Parameters:
  `absoluteDay` - the absolute day
  `nanos` - the nanoseconds (may be negative or larger than one day)
Returns:
  the timestamp

#### timestampTimeZoneFromLocalDateValueAndNanos

    public static ValueTimestampTimeZone timestampTimeZoneFromLocalDateValueAndNanos(long dateValue,
                                                                     long timeNanos)

Converts local date value and nanoseconds to timestamp with time zone.

Parameters:
  `dateValue` - date value
  `timeNanos` - nanoseconds since midnight
Returns:
  timestamp with time zone

#### timestampTimeZoneFromMillis

    public static ValueTimestampTimeZone timestampTimeZoneFromMillis(long ms)

Creates the instance of the `ValueTimestampTimeZone` from milliseconds.

Parameters:
  `ms` - milliseconds since 1970-01-01 (UTC)
Returns:
  timestamp with time zone with specified value and current time zone

#### absoluteDayFromYear

    public static long absoluteDayFromYear(long year)

Calculate the absolute day for a January, 1 of the specified year.

Parameters:
  `year` - the year
Returns:
  the absolute day

#### absoluteDayFromDateValue

    public static long absoluteDayFromDateValue(long dateValue)

Calculate the absolute day from an encoded date value.

Parameters:
  `dateValue` - the date value
Returns:
  the absolute day

#### prolepticGregorianAbsoluteDayFromDateValue

    public static long prolepticGregorianAbsoluteDayFromDateValue(long dateValue)

Calculate the absolute day from an encoded date value in proleptic Gregorian calendar.

Parameters:
  `dateValue` - the date value
Returns:
  the absolute day in proleptic Gregorian calendar

#### dateValueFromAbsoluteDay

    public static long dateValueFromAbsoluteDay(long absoluteDay)

Calculate the encoded date value from an absolute day.

Parameters:
  `absoluteDay` - the absolute day
Returns:
  the date value

#### incrementDateValue

    public static long incrementDateValue(long dateValue)

Return the next date value.

Parameters:
  `dateValue` - the date value
Returns:
  the next date value

#### decrementDateValue

    public static long decrementDateValue(long dateValue)

Return the previous date value.

Parameters:
  `dateValue` - the date value
Returns:
  the previous date value

#### appendDate

    public static void appendDate(java.lang.StringBuilder buff,
                  long dateValue)

Append a date to the string builder.

Parameters:
  `buff` - the target string builder
  `dateValue` - the date value

#### appendTime

    public static void appendTime(java.lang.StringBuilder buff,
                  long nanos)

Append a time to the string builder.

Parameters:
  `buff` - the target string builder
  `nanos` - the time in nanoseconds

#### appendTimeZone

    public static void appendTimeZone(java.lang.StringBuilder buff,
                      short tz)

Append a time zone to the string builder.

Parameters:
  `buff` - the target string builder
  `tz` - the time zone in minutes

#### appendTimestampTimeZone

    public static void appendTimestampTimeZone(java.lang.StringBuilder buff,
                               long dateValue,
                               long timeNanos,
                               short timeZoneOffsetMins)

Formats timestamp with time zone as string.

Parameters:
  `buff` - the target string builder
  `dateValue` - the year-month-day bit field
  `timeNanos` - nanoseconds since midnight
  `timeZoneOffsetMins` - the time zone offset in minutes

#### timeZoneNameFromOffsetMins

    public static java.lang.String timeZoneNameFromOffsetMins(int offsetMins)

Generates time zone name for the specified offset in minutes.

Parameters:
  `offsetMins` - offset in minutes
Returns:
  time zone name

#### convertScale

    public static long convertScale(long nanosOfDay,
                    int scale)

Converts scale of nanoseconds.

Parameters:
  `nanosOfDay` - nanoseconds of day
  `scale` - fractional seconds precision
Returns:
  scaled value