There appears to be many packages for getting/formatting the current date, or finding out the date n time intervals from now. But I must be overlooking the existence of a simple method to set the date (like Windows' date.exe) in Python.
Surely such a function exists? I've been unable to find anything on Google, the python docs (datetime, time, os, etc) or stack overflow. TIA.
edit: To summarize,this page tells you how to get them.
And you can set them using either
win32api.SetSystemTime(year,month,dayOfWeek,day,hour,minute,second,millseconds)
or
os.system("date " + mm/dd/yy)
date.exe also appears to accept mm-dd-yy, 4-digit years, and probably other alternatives.
I prefer the latter for simplicity.
The wDayOfWeek member of the SYSTEMTIME structure is ignored.The date command is fickle and will break depending on regional settings so it's best to avoid it if you want your code to work on multiple environments. - JimSetSystemTimeexpects the parameters in UTC time. The page OP linked to mentionsdatetime.datetime.now()but one will need to usedatetime.datetime.utcnow()if passing the results intowin32api.SetSystemTime- Jim