Converting Millisecond Timestamp to ISO Date With Python
importdatetimets=1348876800000# milliseconds# datetime does not accept milliseconds so must divide by 1,000:dt=datetime.datetime.utcfromtimestamp(ts/1000).replace(tzinfo=datetime.timezone.utc)print(dt.isoformat())# >>> '2012-09-29T00:00:00+00:00'
Relative Time
Relative time (stored in seconds) is the amount of time that has elapsed and does not represent an exact timestamp.
Inventory → Devices:
Uptime: uptime – Relative to the boot time of the device at the time the command was run on the device.
Technology → Routing → * :
Routes:
Age: nhLowestAge
Routing Protocols:
Session Time or Uptime: currStateTime
Relative Time Does Not Change
This is relative to the time when the command was run on the device and does not change. For example:
The device reported uptime of 120 Days 5 Hours when show version was run.
Viewing that snapshot on a day or week later will also show 120 Days 5 Hours.
Converting Time Interval in Seconds to Human-Readable Format With Python
Time conversion in IP Fabric is done in the frontend and is also formatted when exporting to CSV.
The data returned via the API will always be in milliseconds or seconds.
This may differ from other time conversion websites, as seen in the example from epochconverter.com: