Forum Discussion
AustinK
6 years agoQrew Commander
I'm assuming you are using something like date.strftime right now? From what I can see you need to use that function but you will need to convert the milliseconds into seconds so divide them by 1000 before trying to convert them into a date or datetime. This is the solution I have found.
You can also use Pandas to do this if you by any chance have it loaded.
import datetime
date = datetime.datetime.fromtimestamp(milliseconds/1000.0)
date = date.strftime('%Y-%m-%d %H:%M:%S')
You can also use Pandas to do this if you by any chance have it loaded.
JeffKelly1
6 years agoQrew Member
Thanks! I was able to convert the other way since I'm comparing dates from 2 different sources.
Am I missing something? Since I don't need the time of day I am getting matching dates, but this might not work if I needed the time of day.
------------------------------
Jeff Jeff
------------------------------
datetime.utcfromtimestamp(float(str(my_date)[:10])).strftime('%m/%d/%Y')
Am I missing something? Since I don't need the time of day I am getting matching dates, but this might not work if I needed the time of day.
------------------------------
Jeff Jeff
------------------------------