Time Conversions
Convert from unix time to a string
- pyspedas.time_string(float_time=None, fmt=None)
Transform a list of float daytime values to a list of strings.
Example
from pyspedas import time_string
time_string(1444953600.0)
'2015-10-16 00:00:00.000000'
Convert from a string to unix time
- pyspedas.time_double(str_time=None)
Transform a list of datetimes from string to decimal.
Same as time_float.
Example
from pyspedas import time_double
time_double('2015-10-16/14:00')
1445004000.0
Convert from a string or unix time to a datetime object
- pyspedas.time_datetime(time=None, tz=None)
Find python datetime.
- Transform a list of float daytime values to a list of pythonic
‘datetime.datetime’ values.
- Parameters
time (
float/list
offloats
orstr/list
ofstr
, optional) – Input time. The default is None, which returns the time now.- Returns
Datetimes as datetime.datetime.
- Return type
Example
from pyspedas import time_datetime
time_datetime('2015-10-16/14:00')
datetime.datetime(2015, 10, 16, 14, 0, tzinfo=datetime.timezone.utc)