time2unixts(1)

NAME
time2unixts - converts date/time strings to Unix timestamps

SYNOPSIS
time2unixts [-T time_format_template | - -template time_format_template]
[-F | - -float] [-I | - -integer-decimal] [-X | - -integer-hexadecimal] [-0 | - -integer-0x-hexadecimal]
[-H | - -human-readable]
[-s | - -seconds] [-m | - -milliseconds] [-u | - -microseconds] [-n | - -nanoseconds]
time_string [...]
time2unixts [-h | - -help]
time2unixts [-v | - -version]

DESCRIPTION
time2unixts converts date/time strings in the format %Y-%m-%d %H:%M:%S in UTC to Unix timestamps, which is the time (nanoseconds, microseconds, milliseconds, or seconds) since the Unix Epoch, i.e. January 1, 1970, 00:00:00.000000000 UTC.

ARGUMENTS
The following options are available:

time_string ...
    The date/time strings to be converted, as %Y-%m-%d %H:%M:%S[.SSSSSSSSS]. The seconds part may be fractional; the fraction is optional. If no date/time string is provided, the current system time is used.

-T time_format_template | - -template time_format_template
    Sets the template for parsing the date/time strings. Default is ""%Y-%m-%d %H:%M:%S". The formatting is according to strptime(). See strptime(3) for details.

-F | - -float
    Print the Unix timestamp as a floating-point number.

-I | - -integer-decimal
    Print the Unix timestamp as a decimal integer number. This is the default.

-X | - -integer-hexadecimal
    Print the Unix timestamp as a hexadecimal integer number.

-0 | - -integer-0x-hexadecimal
    Print the Unix timestamp as a hexadecimal integer number, prefixed by 0x.

-H | - -human-readable
    Provide the output in human-readable form. Default: off.

-s | - -seconds
    The Unix timestamp is printed in seconds. Default is in nanoseconds.

-m | - -milliseconds
    The Unix timestamp is printed in milliseconds. Default is in nanoseconds.

-u | - -microseconds
    The Unix timestamp is printed in microseconds. Default is in nanoseconds.

-n | - -nanoseconds
    The Unix timestamp is printed in nanoseconds. This is the default.

-h | - -help
    Prints the program's command-line parameters and exits.

-v | - -version
    Prints the program version and exits.

EXIT STATUS
The time2unixts tool exits with 0 on success, and >0 in case of an error.

EXAMPLES

time2unixts

time2unixts --integer-0x-hexadecimal

time2unixts --integer-hexadecimal --seconds

time2unixts "2026-03-17 10:52:35" --seconds

time2unixts "1969-12-20 10:13:20"

time2unixts "1955-12-24 22:22:22.000" --milliseconds

time2unixts "2026-03-17 08:31:19" --human-readable --seconds

time2unixts "2026-03-17 08:31:19" -s

time2unixts "1976-09-29 12:12:03.123" -m

time2unixts -T "%b %d %H:%M:%S %Y %Z" "Jun 4 19:01:25 2036 GMT"

time2unixts -T "%b %d %H:%M:%S %Y %Z" "Sep 29 13:10:12.567890123 1976 CET"

time2unixts --version

time2unixts --help

SEE ALSO
strptime(3) unixts2time(1)

NOTES
This program is part of System-Tools. The latest version of System-Tools can be found on the System-Tools Homepage at System-Tools Homepage: https://www.nntb.no/~dreibh/system-tools/.

AUTHORS
Thomas Dreibholz, Homepage: https://www.nntb.no/~dreibh