¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Python Datetime Processing (US/Eastern)


Python1382
 

Hi,

Does anyone know the directive for converting a string into a datetime in python?

e.g.

DateOne = "20231205 08:30:00 US/Eastern"
datetime.strptime(DateOne,"%Y%m%d %H:%M:%S %???")

where %??? is the unknown directive. Without this directive I receive this message: "ValueError: unconverted data remains: :00 US/Eastern" and I'm not finding great documentation online. I know I could switch to an older TWS API version where EST might be implied but I would rather not do that. I could also see using a parser but that seems like it should be an unnecessary step.


Thanks

Join [email protected] to automatically receive all group messages.