uwacan.time_to_datetime#
- time_to_datetime(input, fmt='RFC 3339', tz='UTC')[source]#
Convert datetimes to the same internal format.
This function takes a few types of input and tries to convert the input to a
whenever.Instant. - Any datetime-like input will be converted directly. - np.datetime64 and Unix timestamps are treated similarly. - Strings are parsed withfmtif given, otherwise a few different common formats are tried.- Parameters:
- inputdatetime-like, string, or numeric.
The input data specifying the time.
- fmtstring, optional
This can be one of the standard formats
"RFC 3339","RFC 2822", or"ISO 8601", handled by whenever. Alternatively, a custom parsing specifier can be supplied, using strptime format codes.- tzstring, default “UTC”
The assumed timezone for the input, if it does not contain one. Unix timestamps have no timezone, and np.datetime64 only supports UTC.
- Returns:
- timewhenever.Instant
The converted time.