Is there a way to return a UTC datetime?

Using returns the local time, as it should. I’m looking for a clean way to return UTC without hard coding the timezone. returns a string - America/ New_York in my case.

Suggestions welcome.

I think python datetime and timedelta objects have methods to do the conversion from local time to UTC.

Hope it helps.

Try this

import datetime

utcdate =

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.

1 Like

Well, we’ve all been there at least once in our lives. Congrats!
:grin: :wine_glass: