---
title: "to unix seconds · RUAL Documentation"
description: "Converts a date, date string, or epoch timestamp to a Unix timestamp in SECONDS : the unit the platform's date fields store. Numbers (and numeric string…"
canonical: https://docs.rual.nl/block-types/date/date_convert_to_unix_seconds
language: en
---

[Cluster](https://docs.rual.nl/cluster)

[Blocks](https://docs.rual.nl/block-types)

[Interfaces](https://docs.rual.nl/interfaces)

[Blueprints](https://docs.rual.nl/blueprints)

[Tutorials](https://docs.rual.nl/tutorials)

[Home automation](https://docs.rual.nl/home-automation)

[Examples](https://docs.rual.nl/examples)

[Reference](https://docs.rual.nl/reference)

[Architecture](https://docs.rual.nl/architecture)

[Troubleshooting](https://docs.rual.nl/troubleshooting)

Other

# to unix seconds

This block is part of the [`date`](https://docs.rual.nl/block-types/date) group and was last modified in core [`v15.0.0`](https://docs.rual.nl/core-versions/150000).

Converts a date, date string, or epoch timestamp to a Unix timestamp in SECONDS : the unit the platform's date fields store. Numbers (and numeric strings) are detected by size: values of 100000000000 (11 digits, March 1973) and above are read as milliseconds and divided, smaller values pass through as seconds; fractional seconds are floored. Pre-1973 millisecond values are outside the detection range : convert those by hand. Anything non-numeric is parsed like every other date pin, in the entity timezone.

- date required `date` A date object, date string, or epoch timestamp in seconds or milliseconds.

- unix seconds `number` The Unix timestamp in seconds. 0 when the input could not be read as a date.

- valid `condition` False when the input was empty, zero, or unparseable : branch on this rather than trusting a 0.

| `unix timestamp` |
| --- |
| `epoch seconds` |
| `milliseconds to seconds` |
| `normalize timestamp` |

A typical wiring for [to unix seconds](https://docs.rual.nl/block-types/date/date_convert_to_unix_seconds): [date now](https://docs.rual.nl/block-types/date/date_currentdate) feeds the `date` pin; the `number` out pin feeds [cast to value](https://docs.rual.nl/block-types/type%2520casting/number_convert_to_value).

[![Studio canvas example for the to unix seconds block: typical wiring for to unix seconds.](https://docs.rual.nl/canvas-examples/date_convert_to_unix_seconds.png)](https://docs.rual.nl/canvas-examples/date_convert_to_unix_seconds.png?v=3)

## Version history

Introduced in [`v15.0.0`](https://docs.rual.nl/core-versions/150000).

- [Back to `date`](https://docs.rual.nl/block-types/date): Return to the main group to view all sub-groups

- [Back to `date`](https://docs.rual.nl/block-types/date?group=date): Return to the group to view all blocks within this group

Was this page helpful? [Tell us what to improve](https://docs.rual.nl/support) · RUAL Docs is an integral component of the [RUAL ecosystem](https://rual.nl)
