#python3 import datetime print( '1: test-{date:%Y-%m-%d_%H:%M:%S}.txt'.format( date=datetime.datetime.now() ) ) d = datetime.datetime.now() print( "2a: {:%B %d, %Y}".format(d))
1: test-2018-02-14_16: 40: 52.txt
2a: March 04, 2018
2b: March 04, 2018
3: today 2018-11-11
Description:
Using the new row format to insert a value into a row in the placeholder {}, the value is the current time.
Then, instead of simply displaying the raw value as {}, use formatting to get the correct date format.
https://docs.python.org/3/library/string.html#formatexamples
Pieter Feb 14 '18 at 3:42 2018-02-14 03:42
source share