Time and Date#

Note

Date variables in a GAUSS dataframe store dates in Posix format, so all “posix” functions work with GAUSS date variables.

Conversion and formatting#

asDate

Converts columns of matrices, string arrays or dataframes to dates, with the option to specify the display format.

dttoposix

Converts DT scalar format to POSIX date/time format.

dttostr

Converts a matrix containing dates in DT scalar format to a string array.

dttostrc

Converts a date in DT Scalar format into a string array.

etstr

Converts elapsed time in hundredths of a second to a string, with days, minutes, hours and seconds.

posixtostrc

Converts a date in Posix time (seconds since the Epoch) into a string array.

strtodt

Converts a string array of dates to a matrix in DT scalar format.

strctodt

Converts string dates to a matrix containing dates in DT Scalar date/time format.

strctoposix

Converts string dates to a matrix containing dates in Posix date/time format.

Sequences#

seqaDT

Creates a sequence of dates in DT scalar format.

seqaPosix

Creates a sequence of dates in Posix date/time format.

Differences and arithmetic#

etdays

Difference between two times, as a 4x1 date vector returned by date, in days.

ethsec

Difference between two times, as a 4x1 date vector returned by date, in hundredths of a second.

hsec

Returns elapsed time since midnight in hundredths of a second.

timeDeltaDT

Adds (or subtracts) time to a DT scalar.

timeDeltaPosix

Adds (or subtracts) time to a posix date-time.

timeDiffDT

Computes the difference between two dates in DT scalar format.

timediffposix

Computes the difference between two dates in Posix date/time format.

Current time and date#

dttime

Creates a matrix in DT scalar format containing only the hour, minute, and second. The date information is zeroed out.

todaydt

Returns system date in DT scalar format. The time returned is always midnight (00:00:00), the beginning of the returned day.

timedt

Returns system date and time in DT scalar format.

Other#

DTV Date Time Vectors#

date

Returns current system date in a 4x1 vector.

datestr

Formats a 4x1 date vector, as returned by date, as mm/dd/yy.

datestring

Formats a 4x1 date vector, as returned by date, as mm/dd/yyyy.

datestrymd

Formats a 4x1 date vector, as returned by date, as yyyymmdd.

dayinyr

Returns the day of year as an integer from a 3x1 or 4x1 vector as returned by date.

dayofweek

Returns the day of week as an integer from a 3x1 or 4x1 vector as returned by date.

dttodtv

Converts DT scalar format to DTV vector format.

dtvnormal

Normalizes a date and time (DTV) vector.

dtvtodt

Converts DTV vector format to DT scalar format.

time

Returns current system time as a 4x1 vector.

timestr

Formats time as hh:mm:ss

UTC functions#

These functions are generally not recommended, because they will make adjustments based on your current time zone.

dttoutc

Converts DT scalar format to UTC scalar format.

dtvtoutc

Converts DTV vector format to UTC scalar format.

timeutc

Returns the number of seconds since January 1, 1970 Greenwich Mean Time.

utctodt

Converts UTC scalar format to DT scalar format.

utctodtv

Converts UTC scalar format to DTV vector format.

Other DT scalar functions#

dtdate

Combines separate scalars or vectors representing year, month, day, hour, minute, second to create a matrix in DT scalar format.

dtday

Creates a matrix in DT scalar format containing only the year, month, and day. Time of day information is zeroed out.