Forum Discussion
JeffKelly1
6 years agoQrew Member
Any tips on how to do this in Python? I've tried using the datetime module but for some reason it's not recognizing my date string, even though my dates are "mm/dd/yyyy" and I'm passing it the "%m/%d/%Y" format. I'm also using pyqb since I'm not that familiar with the QuickBase API yet.
------------------------------
Jeff Jeff
------------------------------
------------------------------
Jeff Jeff
------------------------------
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.
- JeffKelly16 years agoQrew MemberThanks! I was able to convert the other way since I'm comparing dates from 2 different sources.
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
------------------------------