Software Development Kit (SDK) and API Discussions

OnCommand API Services - Convert timestamp to date/time

calori

Hi All,

 

I am trying to convert the timestamp from API Services output to date/time format, but I for some reason I cannot get a date/time format.

I tried to convert using python and I received a message that the year is out of range

 

Follow below an example code:

import datetime

your_timestamp = 1460409856461

print datetime.datetime.fromtimestamp(your_timestamp)

The output is:

ValueError: year is out of range
 

1 ACCEPTED SOLUTION

asulliva

It might be in milliseconds, try dividing by 1000 (and rounding down to the nearest whole number).

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

2 REPLIES 2

asulliva

It might be in milliseconds, try dividing by 1000 (and rounding down to the nearest whole number).

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

calori

Awesome my friend !!!!

 

It works !  Smiley LOL

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public