Temporal Data

Temporal data can be used and stored in Deephaven using DateTimes, Periods, and Durations/Times.

DateTime

A DateTime can be represented with the following patterns: yyyy-MM-ddThh:mm:ss.millis/micros/nanos TZ.   This gets converted into a DBDateTime.

Period

A Period is a duration of time and can be represented with the following patterns: -#Y#M#W#DT#H#M#S.  The negative sign and partial periods are optional. For example, if you wanted to compute the DBDateTime 1 day and 1 hour from another DBDateTime, you could use time+'1dT1h'.

Durations/Times

A Durations/Times can be represented with the following patterns: -hh:mm:ss.millis/micros/nanos.  The negative is optional. This gets converted into a Long representing the nanoseconds since January 1, 1970 UTC. For example, '01:02:03.456' is 1 hour, 2 minutes, 3 seconds, and 456 milliseconds.

Durations/Times can be added to DBDateTimes.

Binning Intervals

Downsampling time series data can be done by calculating the bin intervals for values and then using firstBy or lastBy to select the first or last row for each bin.

For example, using a table named x that contains a DBDateTime column called Timestamp, you can get five-minute interval samples from the data using the following:

downsampledx = x.updateView("TimeBin=upperBin(Timestamp, 5 * MINUTE)").lastBy("TimeBin").dropColumns("TimeBin")

This is a little tedious in that you have to add the TimeBin column to get the lastBy, and then you drop it because you don't want it as part of your result set. An alternate way to do this is to use DownsampledWhereFilter, which does the same downsampling, but with a more simple query.

See DownsampledWhereFilter

Downsampling

Sampling time-series data on some fixed-time interval is a common method used to reduce the required storage space or for increasing processing speed. While it is possible to perform this operation using a combination of more basic Deephaven operations, there is an existing utility that covers many common applications.

The Downsampler takes a time-series table as input and produces a downsampled version. Other than the timestamp and key columns, each output column is produced by an aggregate: typically either last, min, max, sum, first, last, std, var, avg, or array. All aggregates will take match pairs to support renaming the source column (i.e. "Volume=LastSize" when a sum aggregate is applied).

Timestamps from a specified column are grouped into "bins" using a method determined by the timeBinMode (defaults to UPPER, which would put all times between, for example, 3:20 and 3:25 into the 3:25 time bin if 5 minute intervals are used). For some applications, it is useful to have every "time bin" represented, even if there is no data. In this case, one can set the allBins option. Sometimes, as in stock quote data, if there is no new data, it is desirable that the value of the prior bin should be used instead of null. To produce this behavior, specify the relevant column(s) in the maintainState option.

The Downsamples can operate in online mode (default is on), in which case the downsampled table is updated whenever the source changes. If this behavior isn't needed, it is possible to turn off online mode, and run large downsampling jobs using multiple threads in parallel. Online mode supports only single-threaded operation.

Under normal conditions, every time a new row is added to the source table, the downsampled table will "tick". This is because the last time bin is always "active" (i.e., a row at 3:23 will affect the 3:25 bin). This causes a large volume of table updates in the downsampled table (at least one for each new row in the source). Using the excludeLastBin option, the last time bin can be excluded from the output until it can no longer change (assuming timestamps increase monotonically), one can eliminate this behavior. This is useful when logging the downsampled output to another table.

Typical examples:

Downsample quotes, while filling in "empty" time bins, and maintaining state.

import com.illumon.iris.downsampling.Downsampler
downsampledQuotes = Downsampler.downsample(db, quoteTable, "Timestamp", "00:05:00", "Sym")
   .allBins
   .last("Bid","BidSize","Ask","AskSize")
   .maintainState("Bid","BidSize","Ask","AskSize")
   .execute()

Downsample trades, calculating Volume, High and Low per time bin:

import com.illumon.iris.downsampling.Downsampler
downsampledTrades = Downsampler.downsample(db, tradeTable, "Timestamp", "00:05:00", "Symbol")
   .last("Price","Size")
   .sum("Volume=Size")
   .min("Low=Price")
   .max("High=Price")
   .execute()

Setter Method

Type

Req?

Default

Description

timeBinMode

String | Downsampler.TimeBinMode

No

UPPER

How to assign source data to time bins (UPPER/LOWER).

allBins

boolean

No

true

Whether to generate all time bins in the source data range, even if no data matches the bin.

maintainStateColumns

String...

No

N/A

Columns for which to maintain state from one time bin to the next if no new data is present for that bin (only applicable if setAllBins is true).

byStrategy

Table.ByStrategy | String

No

DEFAULT

Strategy to use when generating aggregates

aJStrategy

Table.JoinStrategy | String

No

DEFAULT

Strategy to use when using "aj" joins (when allBins=true, for maintain-state columns).

naturalJoinStrategy

Table.JoinStrategy | String

No

DEFAULT

Strategy to use when joining data to time bins (when allBins=true).

setCalendar

String

No

N/A

Calendar to filter time bins

online

boolean

No

true

Whether the output table should update when the source table ticks.

numThreads

int

No

1

Number of threads to use for parallel downsampling. Using a larger number of threads may improve performance for large source tables.

excludeLastBin

boolean

No

false

Whether to exclude the last/active time bin from the output.

logger

Logger

No

Default system logger

Override the logger used for logging progress as the downsampler proceeds

aggregates

LIst<ComboAggregateFactory.ComboBy>

 

No

N/A

Add a set of aggregate columns to produce in the output.

aggregate

AggType, column

No

N/A

Add an aggregate column to produce in the output table

last

String...

No

N/A

Add a set of columns to produce with the "lastBy" operator.

first

String...

No

N/A

Add a set of columns to produce with the "firstBy" operator.

min

String...

No

N/A

Add a set of columns to produce with the "minBy" operator.

max

String...

No

N/A

Add a set of columns to produce with the "maxBy" operator.

sum

String...

No

N/A

Add a set of columns to produce with the "sumBy" operator.

std

String...

No

N/A

Add a set of columns to produce with the "stdBy" operator.

var

String...

No

N/A

Add a set of columns to produce with the "varBy" operator.

array

String...

No

N/A

Add a set of columns to produce with the "arrayBy" operator.

Calendars Methods

The Calendars class holds the available calendar objects in Deephaven. There are three primary methods to access these calendars:

  1. You can specify the calendar by name. (Note:  Use the calendarNames() method to get a list of available calendar names.)
  2. You can get the default calendar as specified by the Calendar.default property in your configurations, or you can set the default calendar under Settings.
  3. You can use the provided calendars as variables

For example, if you wanted to use the provided USNYSE calendar in your query, you could use the following:

curDayNY = CALENDAR_USYSE.currentDay()

Or equivalently,

from deephaven import *  # Calendars module imported as cals

curDayNY = cals.calendar("USNYSE").currentDay()
 
                    
import com.illumon.util.calendar.Calendars
curDayNY = Calendars.calendar("USNYSE").currentDay()
 
                    

In query strings, you can use the default calendar methods statically:

t2 = t.where("Date = currentDay()")

Method

Description

calendar(final String name)

Returns a specified business calendar.

calendar()

Returns the default business calendar.

calendarNames()

Returns the names of all available calendars

Calendar Methods

Many calendar methods are available to help users obtain time and date related information via queries, as shown below.  The methods that take no date parameter act on the current date. For example nextDay(5) is equivalent to nextDay(currentDay(), 5).

See also: Business Calendar Methods

Method

Description

dayOfWeek()

dayOfWeek(DBDateTime time)

dayOfWeek(java.lang.String date)

Gets the day of the week for a time.

For example, dayOfWeek(20170308) would return Wednesday.

daysInRange(DBDateTime start, DBDateTime end)

daysInRange(java.lang.String start, java.lang.String end)

Gets the days in a given range.

diffDay(DBDateTime start, DBDateTime end)

Returns the amount of time in days between start and end.

diffNanos(DBDateTime start, DBDateTime end)

Returns the amount of time in nanoseconds between start and end.

diffYear(DBDateTime start, DBDateTime end)

Returns the number of years between start and end.

name()

Gets the name of the calendar.

nextDay()

nextDay(DBDateTime time)

nextDay(java.lang.String date)

Gets the next date.

nextDay(int days)

nextDay(DBDateTime time, int days)

nextDay(java.lang.String date, int days)

Gets the date specified by the number of days after the input date.

numberOfDays(DBDateTime start, DBDateTime end)

numberOfDays(java.lang.String start, java.lang.String end)

Gets the number of days in a given range, end date exclusive.

numberOfDays(DBDateTime start, DBDateTime end, boolean endInclusive)

numberOfDays(java.lang.String start, java.lang.String end, boolean endInclusive)

Gets the number of days in a given range, with the option to make the end date inclusive or exclusive.

previousDay()

previousDay(DBDateTime time)

previousDay(java.lang.String date)

Gets the previous date.

previousDay(int days)

previousDay(DBDateTime time, int days)

previousDay(java.lang.String date, int days)

Gets the date specified by the number of days before the input date.

timeZone()

Gets the timezone of the calendar.

Available Timezones

  • TZ_NY(DateTimeZone.forID("America/New_York"))
  • TZ_ET(DateTimeZone.forID("America/New_York"))
  • TZ_MN(DateTimeZone.forID("America/Chicago"))
  • TZ_CT(DateTimeZone.forID("America/Chicago"))
  • TZ_MT(DateTimeZone.forID("America/Denver"))
  • TZ_PT(DateTimeZone.forID("America/Los_Angeles"))
  • TZ_HI(DateTimeZone.forID("Pacific/Honolulu"))
  • TZ_BT(DateTimeZone.forID("America/Sao_Paulo"))
  • TZ_KR(DateTimeZone.forID("Asia/Seoul"))
  • TZ_HK(DateTimeZone.forID("Asia/Hong_Kong"))
  • TZ_JP(DateTimeZone.forID("Asia/Tokyo"))
  • TZ_AT(DateTimeZone.forID("Canada/Atlantic"))
  • TZ_NF(DateTimeZone.forID("Canada/Newfoundland"))
  • TZ_AL(DateTimeZone.forID("America/Anchorage"))
  • TZ_IN(DateTimeZone.forID("Asia/Kolkata"))
  • TZ_CE(DateTimeZone.forID("Europe/Berlin"))
  • TZ_SG(DateTimeZone.forID("Asia/Singapore"))
  • TZ_LON(DateTimeZone.forID("Europe/London"))
  • TZ_MOS(DateTimeZone.forID("Europe/Moscow"))
  • TZ_SHG(DateTimeZone.forID("Asia/Shanghai"))
  • TZ_CH(DateTimeZone.forID("Europe/Zurich"))
  • TZ_NL(DateTimeZone.forID("Europe/Amsterdam"))
  • TZ_TW(DateTimeZone.forID("Asia/Taipei"))
  • TZ_SYD(DateTimeZone.forID("Australia/Sydney"))
  • TZ_UTC(DateTimeZone.UTC)

Business Calendars

Business calendars are used in Deephaven to state when a business entity is operational (or not), including the hours, days and years of regular operations, as well as holidays.

For example, one of the business calendars installed with Deephaven presents temporal information pertaining to the New York Stock Exchange (NYSE), which is open Monday through Friday, from 9:30 a.m. to 4 p.m. Eastern time. The calendar also includes information about the exchange's nine full-day holidays and its partial holidays, which vary from year to year.

Creating a Custom Business Calendar

In addition to the installed business calendars in Deephaven, you can also create your own custom business calendar.

Business calendars are stored in files that use XML formatting to specify the aspects of the calendar, including the timezone, hours and days of the week the business is operational, as well as holidays.

The root element of the XML file is <calendar>, and there are four children elements.

  • <name> is the name of the business calendar (required)
  • <timeZone> provides the time zone used for the calendar (required)
  • <default> provides information about regular hours and days the business is and is not operational
  • <holiday> provides information about individual holidays (special days/times for which the business is non-operational)

name

In the following example, "Colorado" is the name of the calendar:

<name>Colorado</name>

timeZone

The timeZone element provides the timezone used for the calendar in Deephaven. For our example calendar, TZ_MT is the timezone used (U.S. Mountain Time), as shown below.

<timeZone>TZ_MT</timeZone>

default

There are two components included in the default element.

  • businessPeriod - provides the hours of the day that business operations are conducted. The values listed are the opening time and closing time separated by a comma, using a 24-hour clock in the timezone noted in the timeZone element. Note: More than one businessPeriod can be included in the default element. For example, if a business closes regularly for lunch, there could be two businessPeriod components in the default element - one for the period before lunch and one for the period after lunch.
  • weekend - provides the day of the week that business operations are not operational. Each weekend day is presented individually. This is an optional component. If there are no weekends included in the default element, Deephaven will assume the business is operational seven days per week. For our example calendar, we will assume that business in Colorado is operational from 9 a.m. to 6 p.m., Monday through Friday, as shown below:

<default>
    <businessPeriod>09:00,18:00</businessPeriod>
    <weekend>Saturday</weekend>
    <weekend>Sunday</weekend>
</default>

holiday

There are two components included in the holiday element.

  • date - provides the year, month and date of the holiday in the format YYYYMMDD. Each individual holiday must be presented by itself, including a separate record for each year in which it is celebrated. If date is not included in the holiday element, Deephaven will assume there are no holidays.
  • businessPeriod - provides the hours of the day that business operations are conducted. The values listed are the starting time and ending time separated by a comma, using a 24-hour clock in the timezone noted above. If business operations are closed for the entire day, this element is not required.

For our example calendar, we will assume Colorado has full-day holidays for Zebulon Pike's birthday on January 5, Colorado Gold Rush Day on July 11, the anniversary of Colorado statehood on August 1 and Stephen Long's birthday on December 30. We will also specify a partial holiday for Dr. Edwin James' birthday on August 27. These holidays (as celebrated in 2017) are shown below:

<holiday>
    <date>20170105</date>
</holiday>
<holiday>
    <date>20170711</date>
</holiday>
<holiday>
    <date>20171230</date>
</holiday>
<holiday>
    <date>20170801</date>
</holiday>
<holiday>
    <date>20170827</date>
    <businessPeriod>09:00,12:00</businessPeriod>
</holiday>

The entire XML file for a Business Calendar named "Colorado" follows:

Installing Custom Business Calendars

Once a new custom Business Calendar is saved with the .calendar suffix, your system administrator will need to install the file(s) to the Deephaven server(s). Instructions for the system administrator are included in the Installing Custom Calendars and Custom Plotting Themes.

Business Calendar Methods

As shown below, there are many methods specific to Business Calendars that are available to help users obtain information about the times and dates in which a business operates.  The methods that take no date parameter act on the current date, e.g., nextBusinessDay(5) is equivalent to nextBusinessDay(currentDay(), 5).

See also: Calendar Methods.

Method

Description

businessDaysInRange(DBDateTime start, DBDateTime end)

businessDaysInRange(java.lang.String start, java.lang.String end)

Returns the business days between start and end, inclusive.

diffBusinessDay(DBDateTime start, DBDateTime end)

Returns the amount of business time in standard business days between start and end.

diffBusinessNanos(DBDateTime start, DBDateTime end)

Returns the amount of business time in nanoseconds between start and end.

diffBusinessYear(DBDateTime start, DBDateTime end)

Returns the number of business years between start and end.

diffNonBusinessDay(DBDateTime start, DBDateTime end)

Returns the amount of non-business time in standard business days between start and end.

diffNonBusinessNanos(DBDateTime start, DBDateTime end)

Returns the amount of non-business time in nanoseconds between start and end.

fractionOfBusinessDayComplete(DBDateTime time)

Returns the fraction of the business day complete by the given time.

fractionOfBusinessDayRemaining(DBDateTime time)

Returns the fraction of the business day remaining after the given time.

fractionOfStandardBusinessDay(DBDateTime time)

fractionOfStandardBusinessDay(java.lang.String date)

For the given date, returns the ratio of the business day length and the standard business day length.

 

getBusinessSchedule(DBDateTime time)

getBusinessSchedule(String date)

getBusinessSchedule(LocalDate date)

Note: The above methods replace the now deprecated methods shown below:

getBusinessDay(DBDateTime time)
getBusinessDay(java.time.LocalDate date)
getBusinessDay(java.lang.String date)

Gets the indicated business schedule.

 

isBusinessDay(DBDateTime time)

Does time occur on a business day?

isBusinessDay()

isBusinessDay(java.time.LocalDate date)

isBusinessDay(java.lang.String date)

Is the date a business day?

isBusinessTime(DBDateTime time)

Determines if the specified time is a business time.

isLastBusinessDayOfMonth()

isLastBusinessDayOfMonth(DBDateTime time)

isLastBusinessDayOfMonth(java.lang.String date)

Is the time listed the last day of the month, and is there time left in the business day?

isLastBusinessDayOfWeek()

isLastBusinessDayOfWeek(DBDateTime time)

isLastBusinessDayOfWeek(java.lang.String date)

Is the time listed the last day of the week, and is there time left in the business day?

nextBusinessDay()

nextBusinessDay(DBDateTime time)

nextBusinessDay(java.lang.String date)

Gets the next business day.

nextBusinessDay(int n)

nextBusinessDay(DBDateTime time, int n)

nextBusinessDay(java.lang.String date, int n)

Gets the next business date that is n business days after input time.

nextBusinessSchedule()

nextBusinessSchedule(DBDateTime time)

nextBusinessSchedule(java.lang.String date)

Gets the next business schedule.  A business schedule is both the date and the hours the business is open on that date.

 

nextBusinessSchedule(int n)

nextBusinessSchedule(DBDateTime time, int n)

nextBusinessSchedule(java.lang.String date, int n)

Gets the next business schedule that is n business days before input time.

nextNonBusinessDay()

nextNonBusinessDay(DBDateTime time)

nextNonBusinessDay(java.lang.String date)

Gets the next non-business day.

nextNonBusinessDay(int n)

nextNonBusinessDay(DBDateTime time, int n)

nextNonBusinessDay(java.lang.String date, int n)

Gets the next non-business date that is n non-business days after input time.

nonBusinessDaysInRange(DBDateTime start, DBDateTime end)

nonBusinessDaysInRange(java.lang.String start, java.lang.String end)

Returns the non-business days between start and end, inclusive.

numberOfBusinessDays(DBDateTime start, DBDateTime end)

numberOfBusinessDays(java.lang.String start, java.lang.String end)

numberOfBusinessDays(DBDateTime start, DBDateTime end, boolean endInclusive)

numberOfBusinessDays(java.lang.String start, java.lang.String end, boolean endInclusive)

Returns the number of business days between start and end.

numberOfNonBusinessDays(DBDateTime start, DBDateTime end)

numberOfNonBusinessDays(DBDateTime start, DBDateTime end, boolean endInclusive)

numberOfNonBusinessDays(java.lang.String start, java.lang.String end)

numberOfNonBusinessDays(java.lang.String start, java.lang.String end, boolean endInclusive)

Returns the number of non-business days between start and end.

previousBusinessDay()

previousBusinessDay(DBDateTime time)

previousBusinessDay(java.lang.String date)

Gets the previous business day.

previousBusinessDay(int n)

previousBusinessDay(DBDateTime time, int n)

previousBusinessDay(java.lang.String date, int n)

Gets the next business date that is n business days before input time.

previousBusinessSchedule()

previousBusinessSchedule(DBDateTime time)

previousBusinessSchedule(java.lang.String date)

Gets the previous business schedule.

previousBusinessSchedule(int n)

previousBusinessSchedule(DBDateTime time, int n)

previousBusinessSchedule(java.lang.String date, int n)

Gets the next business schedule that is n business days before input time.

previousNonBusinessDay()

previousNonBusinessDay(DBDateTime time)

previousNonBusinessDay(java.lang.String date)

Gets the previous non-business day.

previousNonBusinessDay(int n)

previousNonBusinessDay(DBDateTime time, int n)

previousNonBusinessDay(java.lang.String date, int n)

Gets the next non-business date that is n non-business days before input time.

standardBusinessDayLengthNanos()

Returns the length of a standard business day in nanoseconds.

Business Schedule Methods

A BusinessSchedule is the collection of periods within a 24-hour day when a business is open.  BusinessSchedules may have multiple periods. If a business is open continuously from 8 a.m. to 9 p.m., it would be open for one period.  However, if the business is closed daily for lunch, it would have two periods.

For example, on August 21, 2017, using the USNYSE calendar, the BusinessSchedule would look like this:

2017-08-21 9:30 NY to 2017-08-21 16:00 NY

Method

Description

getBusinessPeriods()

Gets the business periods for the day.

getSOBD()

getStartOfBusinessDay()

Gets the starting time of the business day.

getEOBD()

getEndOfBusinessDay()

Gets the end time of the business day.

getLOBD()

getLengthOfBusinessDay()

Gets the length of the business day in nanoseconds.  If the business day has multiple periods, only the time during the periods is counted.

isBusinessDay()

Is this day a business day? Returns true if yes; false otherwise.

isBusinessTime(final DBDateTime time)

Determines if the specified time is a business time for the day. Returns true if yes; false otherwise.

businessTimeElapsed(final DBDateTime time)

Returns the amount of business time in nanoseconds that has elapsed on the given day by the specified time.

BusinessPeriod Methods

A BusinessPeriod is a continuous block of time in which the business is open. Available methods give the start, end, and length of a BusinessPeriod, as well as whether a time occurs during the period.

Method

Description

getStartTime()

Returns the start of the period.

getEndTime()

Returns the end of the period.

getLength()

Returns the length of the period in nanoseconds.

contains(final DBDateTime time)

Determines if the specified time is within the business period.

DBTimeUtils

DBTimeUtils can be used to create, manipulate, and gather information about DBDateTimes, time/durations, and DBPeriods. All of the functions handle null values.

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 d1<d2 (note: you can just use d1<d2 in the query language)

boolean isAfter(DBDateTime d1, DBDateTime d2)

tests whether d1>d2 (note: you can just use d1>d2 in the query language)

DBDateTime plus(DBDateTime dateTime, long nanos)

returns the sum of a datetime and a time/duration (note: you can use dateTime+nanos in the query language)

DBDateTime plus(DBDateTime dateTime, DBPeriod period)

returns the sum of a datetime and a period (note: you can use dateTime+period in the query language)

long minus(DBDateTime d1, DBDateTime d2)

returns the difference in nanos between two datetimes (note: you can use d1-d2 in the query language)

long minus(DBDateTime d1, long nanos)

returns the difference in nanos between two datetimes (note: you can use d1-d2 in the query language)

long diff(DBDateTime d1, DBDateTime d2)

returns the difference in nanos from d1 to d2 (note: you can use d2-d1 in the query language)

DBDateTime dateAtMidnight(DBDateTime dateTime, DBTimeZone timeZone)

returns a DBDateTime representing that date at midnight

String format(DBDateTime dateTime, DBTimeZone timeZone)

returns a formatted String (date and time) for a DBDateTime

String formatDate(DBDateTime dateTime, DBTimeZone timeZone)

returns a formatted String (date only) for a DBDateTime

String format(long nanos)

returns a formatted String for this datetime passed in as nanos

int dayOfMonth(DBDateTime dateTime, DBTimeZone timeZone)

the day of the month for a datetime

int dayOfWeek(DBDateTime dateTime, DBTimeZone timeZone)

the day of the week for a datetime

int dayOfYear(DBDateTime dateTime, DBTimeZone timeZone)

the day of the year for a datetime

int hourOfDay(DBDateTime dateTime, DBTimeZone timeZone)

the hour of the day for a datetime

int millisOfDay(DBDateTime dateTime, DBTimeZone timeZone)

the milliseconds of the day for a datetime

int millisOfSecond(DBDateTime dateTime, DBTimeZone timeZone)

the milliseconds of the second for a datetime

long nanosOfDay(DBDateTime dateTime, DBTimeZone timeZone)

the nanos of the day for a datetime

long nanosOfSecond(DBDateTime dateTime, DBTimeZone timeZone)

the nanos of the second for a datetime

int minuteOfDay(DBDateTime dateTime, DBTimeZone timeZone)

the minute of the day for a datetime

int minuteOfHour(DBDateTime dateTime, DBTimeZone timeZone)

the minute of the hour for a datetime

int monthOfYear(DBDateTime dateTime, DBTimeZone timeZone)

the month of the year for a datetime

int secondOfDay(DBDateTime dateTime, DBTimeZone timeZone)

the second of the day for a datetime

int secondOfMinute(DBDateTime dateTime, DBTimeZone timeZone)

the second of the minute for a datetime

int year(DBDateTime dateTime, DBTimeZone timeZone)

the year of a datetime

int yearOfCentury(DBDateTime dateTime, DBTimeZone timeZone)

the year of the century for a datetime

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 DBDateTime

final DBDateTime nanosToTime(long nanos)

converts nanoseconds into a DBDateTime

DBDateTime lowerBin(DBDateTime dateTime, long intervalNanos)

bins the dateTimes according to the intervalNanos (returns lower bin)

DBDateTime upperBin(DBDateTime dateTime, long intervalNanos)

bins the dateTimes according to the intervalNanos (returns upper bin)

DBDateTime convertDateTime(String s)

parses a String into a DBDateTime (throws an exception if invalid)

long convertTime(String s)

parses a String into a time/duration (throws an exception if invalid)

DBPeriod convertPeriod(String s)

parses a String into a DBPeriod (throws an exception if invalid)

DBDateTime convertDateTimeQuiet(String s)

parses a String into a DBDateTime (returns null if invalid)

long convertTimeQuiet(String s)

parses a String into a time/duration (returns null if invalid)

DBPeriod convertPeriodQuiet(String s)

parses a String into a DBPeriod (returns null if invalid)