varwg.times.index2timestamp¶
- varwg.times.index2timestamp(idx, dt, refts, **kwargs)[source]¶
Calculates the ISOstring timestamp for a certain index in an equidistant time-series given the reference time (where the index would be 0) and the time discretization. If any of the input parameters contains timezone information, all others also need to contain timezone information.
- Parameters:
- idxstr or datetime-object
The timestamp to determine the index for If it is a string, it will be converted to datetime using the function _datetimefromisoformat Formatting keywords may be passed to this function
- dtstr or timedelta object
The discretization of the time series (the amount of time that elapsed between indices) If used as a string, it needs to be given in the format “keyword1=value1,keyword2=value2”. Keywords must be understood by the timedelta constructor (like days, hours, minutes, seconds) and the values may only be integers.
- reftsstr or datetime-object
The timestamp to determine the index for If it is a string, it will be converted to datetime using the function _datetimefromisoformat Formatting keywords may be passed to this function
- Returns:
- ISO-timestampstring
The ISO-timestamp of a discrete time series array of the given parameters in this format: ‘%Y-%m-%dT%H:%M:%S’
Examples
>>> index2timestamp(25637, 'seconds=10', '2010-09-25T00:00:10') '2010-09-27T23:13:00' >>> index2timestamp(365, 'days=1', '2010-09-25T00:00:10') '2011-09-25T00:00:10'