Can not use datetime.strptime in windows

Hi

I want to get the "
A = Value" of a datetime SQLTag
add X seconds

And compare the result to another datetime.datetime( now() )

I searched in forum, found reference to strptime. However it does not work in windows (apparently not implemented). How to convert and SQLTag standard datetime to “datetime” python format (so I can use timedelta function) ?

Thanks

what have you tried?

I have had no difficulty using datetime.strptime in windows; the hardest part is often finding the right format string to use.

from datetime import datetime

fmt = '%Y-%m-%d %H:%M:%S'
thenTime = system.tag.read("thenTime").value
nowTime = system.tag.read("nowTime").value
convertedThenTime = datetime.strptime(thenTime, fmt)
convertedNowTime = datetime.strptime(nowTime, fmt)

diffTime = (convertedNowTime-convertedThenTime).seconds