DateTime Methods
(DBTimeUtils Class)
Methods in the
DBTimeUtils
class can be used to create, manipulate, and gather information about DBDateTimes, time/durations, and Periods. All of the functions handle null values.
These methods are automatically imported by defa480 Holdings Ltd.ult when using Groovy as your scripting language. When using Python, you'll need to include the from deephaven import *
statement in the query to import the DBTimeUtils class. For example:
from deephaven import *
print dbtu.HOUR
Method |
Description |
---|---|
long millis(DBDateTime dateTime) |
the datetime in milliseconds |
long nanos(DBDateTime dateTime) |
the datetime in nanoseconds |
boolean isBefore(DBDateTime d1, DBDateTime d2) |
tests whether |
boolean isAfter(DBDateTime d1, DBDateTime d2) |
tests whether |
DBDateTime plus(DBDateTime dateTime, long nanos) |
returns the sum of a |
DBDateTime plus(DBDateTime dateTime, DBPeriod period) |
returns the sum of a |
long minus(DBDateTime d1, DBDateTime d2) |
returns the difference in nanos between two |
long minus(DBDateTime d1, long nanos) |
returns the difference in nanos between two |
long diff(DBDateTime d1, DBDateTime d2) |
returns the difference in nanos from |
DBDateTime dateAtMidnight(DBDateTime dateTime, DBTimeZone timeZone) |
returns a |
String format(DBDateTime dateTime, DBTimeZone timeZone) |
returns a formatted String (date and time) for a |
String formatDate(DBDateTime dateTime, DBTimeZone timeZone) |
returns a formatted String (date only) for a |
String format(long nanos) |
returns a formatted String for this |
int dayOfMonth(DBDateTime dateTime, DBTimeZone timeZone) |
the day of the month for a |
int dayOfWeek(DBDateTime dateTime, DBTimeZone timeZone) |
the day of the week for a |
int dayOfYear(DBDateTime dateTime, DBTimeZone timeZone) |
the day of the year for a |
int hourOfDay(DBDateTime dateTime, DBTimeZone timeZone) |
the hour of the day for a |
int millisOfDay(DBDateTime dateTime, DBTimeZone timeZone) |
the milliseconds of the day for a |
int millisOfSecond(DBDateTime dateTime, DBTimeZone timeZone) |
the milliseconds of the second for a |
long nanosOfDay(DBDateTime dateTime, DBTimeZone timeZone) |
the nanos of the day for a |
long nanosOfSecond(DBDateTime dateTime, DBTimeZone timeZone) |
the nanos of the second for a |
int minuteOfDay(DBDateTime dateTime, DBTimeZone timeZone) |
the minute of the day for a |
int minuteOfHour(DBDateTime dateTime, DBTimeZone timeZone) |
the minute of the hour for a |
int monthOfYear(DBDateTime dateTime, DBTimeZone timeZone) |
the month of the year for a |
int secondOfDay(DBDateTime dateTime, DBTimeZone timeZone) |
the second of the day for a |
int secondOfMinute(DBDateTime dateTime, DBTimeZone timeZone) |
the second of the minute for a |
int year(DBDateTime dateTime, DBTimeZone timeZone) |
the year of a |
int yearOfCentury(DBDateTime dateTime, DBTimeZone timeZone) |
the year of the century for a |
final long millisToNanos(long millis) |
converts milliseconds to nanoseconds |
final long nanosToMillis(long nanos) |
converts nanoseconds to milliseconds |
final DBDateTime millisToTime(long millis) |
converts milliseconds into a |
final DBDateTime nanosToTime(long nanos) |
converts nanoseconds into a |
DBDateTime lowerBin(DBDateTime dateTime, long intervalNanos) |
bins the |
DBDateTime upperBin(DBDateTime dateTime, long intervalNanos) |
bins the |
DBDateTime convertDateTime(String s) |
parses a String into a |
long convertTime(String s) |
parses a String into a |
DBPeriod convertPeriod(String s) |
parses a String into a |
DBDateTime convertDateTimeQuiet(String s) |
parses a String into a |
long convertTimeQuiet(String s) |
parses a String into a |
DBPeriod convertPeriodQuiet(String s) |
parses a String into a |
Last Updated: 16 February 2021 18:07 -04:00 UTC Deephaven v.1.20200928 (See other versions)
Deephaven Documentation Copyright 2016-2020 Deephaven Data Labs, LLC All Rights Reserved