Development documentation · 0.2.3 30c2f8ba · Intro examples tested with 0.2.3 · Version details · Known limitations

gwexpy.time.tconvert#

gwexpy.time.tconvert(gpsordate: SupportsToGps = 'now', *args, t=<omitted>, **kwargs)#

Convert a time between GPS seconds and UTC datetime.

This function automatically detects the type of the input. If it is numeric (or an array of numbers), it is assumed to be a GPS time and is converted to a datetime (like from_gps). If the input is a string, datetime, or an array of those types, it is converted to GPS seconds (like to_gps).

Parameters:
  • gpsordate (numeric, str, datetime.datetime, array-like, optional) – The input time(s) to convert. Defaults to “now”.

  • *args – Additional positional arguments passed to the underlying converter.

  • t (numeric, str, datetime.datetime, array-like, optional) – GWexpy compatibility alias for gpsordate. Supplying both names is an error.

  • **kwargs – Additional keyword arguments passed to the underlying converter.

Returns:

The converted time. The return type depends on the input type.

Return type:

float, datetime.datetime, or numpy.ndarray