DateTime

Current DateTime

Returns the current dateTime –> learn more

CURRENT_DATETIME([@time_zone])

Return type

dateTime

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@time_zone

any of: ACDT, ACST, ACT, ACT, ACWST, ADT, AEDT, AEST, AFT, AKDT, AKST, AMST, AMT, AMT, ART, AST, AST, AWST, AZOST, AZOT, AZT, BDT, BIOT, BIT, BOT, BRST, BRT, BST, BST, BST, BTT, CAT, CCT, CDT, CDT, CEST, CET, CHADT, CHAST, CHOT, CHOST, CHST, CHUT, CIST, CIT, CKT, CLST, CLT, COST, COT, CST, CST, CST, CT, CVT, CWST, CXT, DAVT, DDUT, DFT, EASST, EAST, EAT, ECT, ECT, EDT, EEST, EET, EGST, EGT, EIT, EST, FET, FJT, FKST, FKT, FNT, GALT, GAMT, GET, GFT, GILT, GIT, GMT, GST, GST, GYT, HDT, HAEC, HST, HKT, HMT, HOVST, HOVT, ICT, IDLW, IDT, IOT, IRDT, IRKT, IRST, IST, IST, IST, JST, KALT, KGT, KOST, KRAT, KST, LHST, LHST, LINT, MAGT, MART, MAWT, MDT, MET, MEST, MHT, MIST, MIT, MMT, MSK, MST, MST, MUT, MVT, MYT, NCT, NDT, NFT, NPT, NST, NT, NUT, NZDT, NZST, OMST, ORAT, PDT, PET, PETT, PGT, PHOT, PHT, PKT, PMDT, PMST, PONT, PST, PST, PYST, PYT, RET, ROTT, SAKT, SAMT, SAST, SBT, SCT, SDT, SGT, SLST, SRET, SRT, SST, SST, SYOT, TAHT, THA, TFT, TJT, TKT, TLT, TMT, TRT, TOT, TVT, ULAST, ULAT, UTC, UYST, UYT, UZT, VET, VLAT, VOLT, VOST, VUT, WAKT, WAST, WAT, WEST, WET, WIT, WST, YAKT, YEKT

false

(UTC (default))

New DateTime

Constructs a dateTime from a year, month, day, hour, minute, and second –> learn more

DATETIME(@year, @month, @day, @hour, @minute, @second)

Return type

dateTime

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@year

true

-

@month

true

-

@day

true

-

@hour

true

-

@minute

true

-

@second

true

-

DateTime add

Add a period of time to a dateTime –> learn more

DATETIME_ADD(@dateTime_expression, INTERVAL @integer_expression @dateTime_part)

Return type

dateTime

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@integer_expression

true

-

@dateTime_part

any of: year, quarter, month, week, day, hour, minute, second, millisecond, microsecond

true

((e.g., days))

@dateTime_expression

true

-

DateTime diff

Calculate distance between two dateTimes –> learn more

DATETIME_DIFF(@dateTime_expression, @dateTime_expression_2, @dateTime_part)

Return type

integer

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@dateTime_expression_2

true

-

@dateTime_expression

true

-

@dateTime_part

any of: year, quarter, month, week, day, hour, minute, second, millisecond, microsecond

true

((e.g., days))

DateTime subtract

Subtract a period of time from a dateTime –> learn more

DATETIME_SUB(@dateTime_expression, INTERVAL @integer_expression @dateTime_part)

Return type

dateTime

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@integer_expression

true

-

@dateTime_part

any of: year, quarter, month, week, day, hour, minute, second, millisecond, microsecond

true

((e.g., days))

@dateTime_expression

true

-

DateTime truncate

Truncates a DateTime to the nearest boundary –> learn more

DATETIME_TRUNC(@dateTime_expression, @dateTime_truncate_part)

Return type

dateTime

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@dateTime_expression

true

-

@dateTime_truncate_part

any of: hour, minute, second, millisecond, microsecond, day, month, quarter, year, week(sunday), week(monday), week(tuesday), week(wednesday), week(thursday), week(friday), week(saturday), ISOquarter, ISOyear

true

((e.g., minutes))

DateTime extract

Extracts the date or time part (e.g, hour) from a DateTime –> learn more

EXTRACT(@dateTime_part FROM @date_expression)

Return type

integer

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@dateTime_part

any of: YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND, MILLISECOND, MICROSECOND, DAYOFYEAR, DAYOFWEEK, ISOYEAR, ISOWEEK

true

((e.g., hour))

@date_expression

true

-

Format dateTime

Returns a formatted string from a dateTime –> learn more

FORMAT_DATETIME(@format_string, @dateTime_expression)

Return type

string

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@dateTime_expression

true

-

@format_string

any string

true

(e.g., %Y-%m-%d %H:%M:%S)

More details about format strings here

Parse dateTime

Parses a dateTime from a string –> learn more

[@safe]PARSE_DATETIME(@format_string, @dateTime_string)

Return type

dateTime

Parameters

NameTypeAllowed valuesRequiredPlaceholder (in UI)

@dateTime_string

any string

true

-

@format_string

any string

true

(e.g., %Y-%m-%d %H:%M:%S)

@safe

true

-

More details about format strings here

Last updated