Type conversion functions

Note

The output value is relative to UTC, not to the timezone of the input value.

**Syntax**

```
toUnixTimestamp64Second(value)
```

**Arguments**

- `value` — DateTime64 value with any precision. [`DateTime64`](/docs/sql-reference/data-types/datetime64)

**Returned value**

Returns a Unix timestamp in seconds. [`Int64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
WITH toDateTime64('2025-02-13 23:31:31.011', 3, 'UTC') AS dt64
SELECT toUnixTimestamp64Second(dt64);
```

```
┌─toUnixTimestamp64Second(dt64)─┐
│                    1739489491 │
└───────────────────────────────┘
```

- [Common issues with data conversion](#common-issues-with-data-conversion)- [Notes on `toString` functions](#to-string-functions)- [Notes on `toDate`/`toDateTime` functions](#to-date-and-date-time-functions)- [CAST](#CAST)- [DATE](#DATE)- [accurateCast](#accurateCast)- [accurateCastOrDefault](#accurateCastOrDefault)- [accurateCastOrNull](#accurateCastOrNull)- [formatRow](#formatRow)- [formatRowNoNewline](#formatRowNoNewline)- [fromUnixTimestamp64Micro](#fromUnixTimestamp64Micro)- [fromUnixTimestamp64Milli](#fromUnixTimestamp64Milli)- [fromUnixTimestamp64Nano](#fromUnixTimestamp64Nano)- [fromUnixTimestamp64Second](#fromUnixTimestamp64Second)- [parseDateTime](#parseDateTime)- [parseDateTime32BestEffort](#parseDateTime32BestEffort)- [parseDateTime32BestEffortOrNull](#parseDateTime32BestEffortOrNull)- [parseDateTime32BestEffortOrZero](#parseDateTime32BestEffortOrZero)- [parseDateTime64](#parseDateTime64)- [parseDateTime64BestEffort](#parseDateTime64BestEffort)- [parseDateTime64BestEffortOrNull](#parseDateTime64BestEffortOrNull)- [parseDateTime64BestEffortOrZero](#parseDateTime64BestEffortOrZero)- [parseDateTime64BestEffortUS](#parseDateTime64BestEffortUS)- [parseDateTime64BestEffortUSOrNull](#parseDateTime64BestEffortUSOrNull)- [parseDateTime64BestEffortUSOrZero](#parseDateTime64BestEffortUSOrZero)- [parseDateTime64InJodaSyntax](#parseDateTime64InJodaSyntax)- [parseDateTime64InJodaSyntaxOrNull](#parseDateTime64InJodaSyntaxOrNull)- [parseDateTime64InJodaSyntaxOrZero](#parseDateTime64InJodaSyntaxOrZero)- [parseDateTime64OrNull](#parseDateTime64OrNull)- [parseDateTime64OrZero](#parseDateTime64OrZero)- [parseDateTimeBestEffort](#parseDateTimeBestEffort)- [parseDateTimeBestEffortOrNull](#parseDateTimeBestEffortOrNull)- [parseDateTimeBestEffortOrZero](#parseDateTimeBestEffortOrZero)- [parseDateTimeBestEffortUS](#parseDateTimeBestEffortUS)- [parseDateTimeBestEffortUSOrNull](#parseDateTimeBestEffortUSOrNull)- [parseDateTimeBestEffortUSOrZero](#parseDateTimeBestEffortUSOrZero)- [parseDateTimeInJodaSyntax](#parseDateTimeInJodaSyntax)- [parseDateTimeInJodaSyntaxOrNull](#parseDateTimeInJodaSyntaxOrNull)- [parseDateTimeInJodaSyntaxOrZero](#parseDateTimeInJodaSyntaxOrZero)- [parseDateTimeOrNull](#parseDateTimeOrNull)- [parseDateTimeOrZero](#parseDateTimeOrZero)- [reinterpret](#reinterpret)- [reinterpretAsDate](#reinterpretAsDate)- [reinterpretAsDateTime](#reinterpretAsDateTime)- [reinterpretAsFixedString](#reinterpretAsFixedString)- [reinterpretAsFloat32](#reinterpretAsFloat32)- [reinterpretAsFloat64](#reinterpretAsFloat64)- [reinterpretAsInt128](#reinterpretAsInt128)- [reinterpretAsInt16](#reinterpretAsInt16)- [reinterpretAsInt256](#reinterpretAsInt256)- [reinterpretAsInt32](#reinterpretAsInt32)- [reinterpretAsInt64](#reinterpretAsInt64)- [reinterpretAsInt8](#reinterpretAsInt8)- [reinterpretAsString](#reinterpretAsString)- [reinterpretAsUInt128](#reinterpretAsUInt128)- [reinterpretAsUInt16](#reinterpretAsUInt16)- [reinterpretAsUInt256](#reinterpretAsUInt256)- [reinterpretAsUInt32](#reinterpretAsUInt32)- [reinterpretAsUInt64](#reinterpretAsUInt64)- [reinterpretAsUInt8](#reinterpretAsUInt8)- [reinterpretAsUUID](#reinterpretAsUUID)- [toBFloat16](#toBFloat16)- [toBFloat16OrNull](#toBFloat16OrNull)- [toBFloat16OrZero](#toBFloat16OrZero)- [toBool](#toBool)- [toDate](#toDate)- [toDate32](#toDate32)- [toDate32OrDefault](#toDate32OrDefault)- [toDate32OrNull](#toDate32OrNull)- [toDate32OrZero](#toDate32OrZero)- [toDateOrDefault](#toDateOrDefault)- [toDateOrNull](#toDateOrNull)- [toDateOrZero](#toDateOrZero)- [toDateTime](#toDateTime)- [toDateTime32](#toDateTime32)- [toDateTime64](#toDateTime64)- [toDateTime64OrDefault](#toDateTime64OrDefault)- [toDateTime64OrNull](#toDateTime64OrNull)- [toDateTime64OrZero](#toDateTime64OrZero)- [toDateTimeOrDefault](#toDateTimeOrDefault)- [toDateTimeOrNull](#toDateTimeOrNull)- [toDateTimeOrZero](#toDateTimeOrZero)- [toDecimal128](#toDecimal128)- [toDecimal128OrDefault](#toDecimal128OrDefault)- [toDecimal128OrNull](#toDecimal128OrNull)- [toDecimal128OrZero](#toDecimal128OrZero)- [toDecimal256](#toDecimal256)- [toDecimal256OrDefault](#toDecimal256OrDefault)- [toDecimal256OrNull](#toDecimal256OrNull)- [toDecimal256OrZero](#toDecimal256OrZero)- [toDecimal32](#toDecimal32)- [toDecimal32OrDefault](#toDecimal32OrDefault)- [toDecimal32OrNull](#toDecimal32OrNull)- [toDecimal32OrZero](#toDecimal32OrZero)- [toDecimal64](#toDecimal64)- [toDecimal64OrDefault](#toDecimal64OrDefault)- [toDecimal64OrNull](#toDecimal64OrNull)- [toDecimal64OrZero](#toDecimal64OrZero)- [toDecimalString](#toDecimalString)- [toFixedString](#toFixedString)- [toFloat32](#toFloat32)- [toFloat32OrDefault](#toFloat32OrDefault)- [toFloat32OrNull](#toFloat32OrNull)- [toFloat32OrZero](#toFloat32OrZero)- [toFloat64](#toFloat64)- [toFloat64OrDefault](#toFloat64OrDefault)- [toFloat64OrNull](#toFloat64OrNull)- [toFloat64OrZero](#toFloat64OrZero)- [toInt128](#toInt128)- [toInt128OrDefault](#toInt128OrDefault)- [toInt128OrNull](#toInt128OrNull)- [toInt128OrZero](#toInt128OrZero)- [toInt16](#toInt16)- [toInt16OrDefault](#toInt16OrDefault)- [toInt16OrNull](#toInt16OrNull)- [toInt16OrZero](#toInt16OrZero)- [toInt256](#toInt256)- [toInt256OrDefault](#toInt256OrDefault)- [toInt256OrNull](#toInt256OrNull)- [toInt256OrZero](#toInt256OrZero)- [toInt32](#toInt32)- [toInt32OrDefault](#toInt32OrDefault)- [toInt32OrNull](#toInt32OrNull)- [toInt32OrZero](#toInt32OrZero)- [toInt64](#toInt64)- [toInt64OrDefault](#toInt64OrDefault)- [toInt64OrNull](#toInt64OrNull)- [toInt64OrZero](#toInt64OrZero)- [toInt8](#toInt8)- [toInt8OrDefault](#toInt8OrDefault)- [toInt8OrNull](#toInt8OrNull)- [toInt8OrZero](#toInt8OrZero)- [toInterval](#toInterval)- [toIntervalDay](#toIntervalDay)- [toIntervalHour](#toIntervalHour)- [toIntervalMicrosecond](#toIntervalMicrosecond)- [toIntervalMillisecond](#toIntervalMillisecond)- [toIntervalMinute](#toIntervalMinute)- [toIntervalMonth](#toIntervalMonth)- [toIntervalNanosecond](#toIntervalNanosecond)- [toIntervalQuarter](#toIntervalQuarter)- [toIntervalSecond](#toIntervalSecond)- [toIntervalWeek](#toIntervalWeek)- [toIntervalYear](#toIntervalYear)- [toLowCardinality](#toLowCardinality)- [toString](#toString)- [toStringCutToZero](#toStringCutToZero)- [toTime](#toTime)- [toTime64](#toTime64)- [toTime64OrNull](#toTime64OrNull)- [toTime64OrZero](#toTime64OrZero)- [toTimeOrNull](#toTimeOrNull)- [toTimeOrZero](#toTimeOrZero)- [toUInt128](#toUInt128)- [toUInt128OrDefault](#toUInt128OrDefault)- [toUInt128OrNull](#toUInt128OrNull)- [toUInt128OrZero](#toUInt128OrZero)- [toUInt16](#toUInt16)- [toUInt16OrDefault](#toUInt16OrDefault)- [toUInt16OrNull](#toUInt16OrNull)- [toUInt16OrZero](#toUInt16OrZero)- [toUInt256](#toUInt256)- [toUInt256OrDefault](#toUInt256OrDefault)- [toUInt256OrNull](#toUInt256OrNull)- [toUInt256OrZero](#toUInt256OrZero)- [toUInt32](#toUInt32)- [toUInt32OrDefault](#toUInt32OrDefault)- [toUInt32OrNull](#toUInt32OrNull)- [toUInt32OrZero](#toUInt32OrZero)- [toUInt64](#toUInt64)- [toUInt64OrDefault](#toUInt64OrDefault)- [toUInt64OrNull](#toUInt64OrNull)- [toUInt64OrZero](#toUInt64OrZero)- [toUInt8](#toUInt8)- [toUInt8OrDefault](#toUInt8OrDefault)- [toUInt8OrNull](#toUInt8OrNull)- [toUInt8OrZero](#toUInt8OrZero)- [toUUID](#toUUID)- [toUUIDOrZero](#toUUIDOrZero)- [toUnixTimestamp64Micro](#toUnixTimestamp64Micro)- [toUnixTimestamp64Milli](#toUnixTimestamp64Milli)- [toUnixTimestamp64Nano](#toUnixTimestamp64Nano)- [toUnixTimestamp64Second](#toUnixTimestamp64Second)

Was this page helpful?