frappe.utils.data.nowtime() returns the local time, as it should. I’m looking for a clean way to return UTC without hard coding the timezone.
frappe.utils.data.get_time_zone() returns a string - America/ New_York in my case.
I think python datetime and timedelta objects have methods to do the conversion from local time to UTC.
Hope it helps.
utcdate = datetime.datetime.now(dateutil.tz.tzutc())
Thanks @MCD-50 and @littlehera ! I got it working using
datetime.datetime.utcnow(). Unfortunately another RTFM moment for me, I was handling the
import wrong and thought there was a conflict with the frappe tools.
Well, we’ve all been there at least once in our lives. Congrats!