Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How can I proper date time value from unix time? without wasting too much if your time.
The question is published on by Tutorial Guruji team.
The question is published on by Tutorial Guruji team.
UNIX Timestamp
1262304000 1224633600 940636800 939772800 1332288000 1096934400 1088121600 ...
1.Try
frmt_date = dt.datetime.utcfromtimestamp(1088121600).strftime("%Y/%m/%d %H:%M")
Those results of time value were 00:00
.
(result)
2012-10-11 00:00 2004-04-20 00:00 1999-01-07 00:00 ....
Try
def xldate_to_datetime(xldate): temp = dt.datetime(1899, 12, 30) delta = dt.timedelta(days=xldate) return temp+delta ts = "1262304000" tsxl = ((int(ts)/60)/60)/24 + 25569 readabledate = xldate_to_datetime(tsxl) print(readabledate)
results of time value were all 00:00
, though.
How can I get proper time from those UNIX https://i.stack.imgur.com/khDmi.jpg
Answer
Another approach
>>> mytime = 1332288000 >>> import datetime as dt >>> frmt_date = dt.datetime.utcfromtimestamp(mytime).strftime("%Y/%m/%d %H:%M") >>> print(frmt_date) 2012/03/21 00:00 >>> mytime = mytime + 10000 >>> frmt_date = dt.datetime.utcfromtimestamp(mytime).strftime("%Y/%m/%d %H:%M") >>> print(frmt_date) 2012/03/21 02:46
So, your date times were indeed at 00:00
We are here to answer your question about How can I proper date time value from unix time? - If you find the proper solution, please don't forgot to share this with your team members.