Skip to content

DateTime.ToUnixTime

Rodrigo Celso de Lima Porto edited this page Jan 13, 2026 · 2 revisions

Converts a Power Query datetime value to Unix time (seconds since 1970-01-01 00:00:00).

Syntax

DateTime.ToUnixTime(
    datetimeToConvert as datetime
) as number

Parameters

  • datetimeToConvert: A datetime value to convert.

Return Value

Converts datetime to Unixtime, which consists of a number representing the total seconds between datetimeToConvert and the Unix epoch (1970-01-01 00:00:00). Values are negative for datetimes before the epoch.

Remarks

  • No timezone conversion is performed β€” treat the input as UTC if you need UTC-based Unix time.

Example

DateTime.ToUnixTime(#datetime(2023, 1, 1, 0, 0, 0))

Result

1672531200

Clone this wiki locally