# Striim 3.9.4 / 3.9.5 documentation

##### Date functions

See http://joda-time.sourceforge.net/apidocs/org/joda/time/Period.html for an explanation of the Period object. A P in printed results represents a Period object.

function

description

notes

add a Period to a DateTime value

for example, DADD(ts, DHOURS(2)) adds two hours to the value of ts

DAFTER(DateTime, DateTime)

true if the second date is after the first

DBEFORE(DateTime, DateTime)

true if the second date is before the first

DBETWEEN(DateTime, DateTime, DateTime)

true if the first date is after the second and before the third

DBETWEEN( origTs, DSUBTRACT(ts, DSECS(1)), DADD(ts, DSECS(1)) ) == true

DDAYS(DateTime)

return the day of the month of the DateTime

DDAYS(Integer)

return Integer days as a Period for DADD or DSUBSTRACT

DDIFF(DateTime, DateTime)

return a Period in which the difference in milliseconds between the two dates is stored

DDIFF(LocalDate, LocalDate)

return the number of whole days between the two partial datetimes as an Integer

DHOURS(DateTime)

return the hour of the day of the DateTime

DHOURS(Integer)

return Integer hours as a Period for DADD or DSUBSTRACT

DMILLIS(DateTime)

return the milliseconds of the DateTime

DMILLIS(Integer)

return Integer milliseconds as a Period for DADD or DSUBSTRACT

DMINS(DateTime)

return the minutes of the hour of the DateTime

DMINS(Integer)

return Integer minutes as a Period for DADD or DSUBSTRACT

DMONTHS(DateTime)

return the month of the year of the DateTime

DMONTHS(Integer)

return Integer months as a Period for DADD or DSUBSTRACT

DNOW()

return the current system time as DateTime

DSECS(DateTime)

return the seconds of the DateTime

DSECS(Integer)

return Integer seconds as a Period for DADD or DSUBSTRACT

DSUBTRACT(DateTime, Period)

subtract a Period from a date

for example, DSUBTRACT(ts, DHOURS(2)) subtracts two hours from the value of ts

DYEARS(DateTime)

return the year of the DateTime

DYEARS(Integer)

return Integer years as a Period for DADD or DSUBSTRACT

TO_DATE(Long)

convert an epoch time value to a DateTime

See MultiLogApp for an example.

TO_DATE(Object)

convert a Date, sql.Date. sql.Timestamp, Long, or String to a DateTime

For String input, recommended only for patterns not supported by TO_DATEF.

Depending on the format of the input value, output format may be an ISO-formatted date, yyyy/MM/dd, yyyy/MM/dd with time, yyyy-MMM-dd, yyyy-MMM-dd with time, or yyyy/MM/dd HH:mm:ss.SSS. Use TO_Date(Object, String) for other patterns.

When using an aggregate function on a DateTime field, use TO_DATE to convert the returned object to a DateTime, for example, select TO_DATE(last(dateTime)) as dateTime.

TO_DATE(Object, String)

convert a String to a DateTime using any org.joda.time.format.DateTimeFormat pattern

Recommended only for patterns not supported by TO_DATEF. See MultiLogApp for an example.

TO_DATEF(Object, String)

convert a String to a DateTime using an org.joda.time.format.DateTimeFormat pattern containing only y, M, d, h, m, s, and S

TO_DATEF is over ten times faster than the TO_DATE functions, so is preferred for supported formats.

See the joda-time API reference for information on writing pattern strings; see PosApp for an example.

TO_STRING(DateTime, String)

convert a DateTime to a String with specific format

Striim supports all date functions natively associated with Joda-Time. See http://joda-time.sourceforge.net/apidocs for more information.