Converting GPS times with GWpy#

The command-line tool gwpy-tconvert provides a convenient way to convert to and from GPS times using GWpy.

gwpy-tconvert is just a simple wrapper around gwpy.time.tconvert(); for more details, see Times and timestamps.

Usage#

Primitive command-line interface to gwpy.time.tconvert.

Either pass a GPS time to convert to a date string, or a date string to convert to a GPS time.

Usage: gwpy-tconvert [-h] [-V] [-l] [-f FORMAT] [input ...]

Positional arguments#

input

GPS or datetime string to convert

Options#

-V, --version

show version number and exit

-l, --local

print datetimes in local timezone

Default: False

-f, --format

output datetime format (default: “’%Y-%m-%d %H:%M:%S.%f %Z’”)

Default: '%Y-%m-%d %H:%M:%S.%f %Z'

Examples:

Convert GPS time to date string:

$ gwpy-tconvert 1126259462

Convert date string to GPS time:

$ gwpy-tconvert 2015-09-14 09:50:45

Find GPS time now:

$ gwpy-tconvert now

Find GPS time for the start of today:

$ gwpy-tconvert today