1/27/2020

python year month day expression using datetime

Without any separator
import datetime
datetime.datetime.now().strftime("%Y%m%d%H%M%S")
Using - as separator
import datetime
datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
Using _ as separator
import datetime
datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")

1/03/2020