Skip to content

kwo/uts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UTS Unix Timestamp

uts is a tool to convert dates to unix timestamps and back. It compiles to a static binary without external dependencies and includes its own timezone database making it a perfect tool for minimal installations.

Usage

Usage:
    uts --help                              print help and exit
    uts --version [-v]                      print (extended) version and exit
    uts                                     print current unix timestamp
    uts <unix timestamp>                    parse unix timestamp and print date
    uts <YYYY-MM-DDTHH:MM:SS>               parse datetime in local timezone, print unix timestamp
    uts <YYYY-MM-DDTHH:MM:SSZ>              parse datetime in UTC, print unix timestamp
    uts <YYYY-MM-DDTHH:MM:SS+02:00>         parse datetime with given timezone, print unix timestamp
    uts <YYYY-MM-DD> <HH:MM:SS>             parse date and time and print unix timestamp
    uts <YYYY-MM-DD> <HH:MM:SS> <timezone>  parse date, time, timezone and print unix timestamp

Examples

Print the current unix timestamp.

uts
1696283053

Parse the given unix timestamp.

uts 1696283053
2023-10-02T23:44:13+02:00

Parse the given date using the local timezone.

uts 2023-10-02T23:44:13
1696283053

Parse the given date using the UTC timezone.

uts 2023-10-02T21:44:13Z
1696283053

Parse the given date using a timezone offset.

uts 2023-10-02T23:44:13+02:00
1696283053

Parse the date and time, given as two separate arguments, using the local timezone.

uts 2023-10-02 23:44:13
1696283053

Parse the date and time using a timezone offset.

uts 2023-10-02 23:44:13 02:00
1696283053

Parse the date and time using a timezone offset.

uts 2023-10-02 14:44:13 -07:00
1696283053

Parse the date and time using a named timezone.

uts 2023-10-02 23:44:13 Europe/Berlin
1696283053

Installation (MacOS only)

brew install kwo/tools/uts