Odil :
I have following test.bat file:
:begin
@echo off
python -c "from datetime import datetime;import sys;sys.stdout.write(datetime.strptime('20200220', '%Y%m%d').replace(day = 1).strftime('%Y%m%d'))"
When I run it from cmd, I get:
ValueError: time data '20200220' does not match format 'mYd'
Please ignore my style of writing, am I missing something?
wwii :
Not sure why but you need to escape the %
. This works.
...
python -c "from datetime import datetime;import sys;sys.stdout.write(datetime.strptime('20200220', '%%Y%%m%%d').replace(day = 1).strftime('%%Y%%m%%d'))"
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=410740&siteId=1