Version: v0.7.1 - Beta.  We welcome contributors & feedback.

Date.unixTime

$date.unixTime() -> number

Description

Get the current Unix timestamp (seconds since January 1st, 1970 at 00:00:00 UTC) of this Date object.

This is a timezone-independent way of representing a moment in time, that can be stored in database tables and easily compared with other times.

$date = Date.create('3 days ago')

$date.unixTime()
//= 1627602121

You can also call unixTime directly on the Date module to get the current timestamp.

Date.unixTime()
//= 1627662156

See Also