glimr/utils/unix_timestamp
Unix Timestamp Utils
Convenience functions for working with Unix timestamps. Returns the current time as integer seconds or nanoseconds since the Unix epoch (January 1, 1970). Useful for storing timestamps in database columns with unix_timestamp().
Values
pub fn current_year() -> Int
Returns the current year as an integer. Useful when you need to print out the current year on a website footer alongside a copyright for example.
Example:
let year = unix_timestamp.current_year()
// => 2026
pub fn now() -> Int
Returns the current Unix timestamp in seconds since epoch. Use this for storing timestamps in database columns with the unix_timestamp() schema type.
Example:
let created_at = unix_timestamp.now()
// => 1734700800