python
[Python] F-string format datetime
import datetime
now = datetime.datetime.now()
print(f'{now:%Y-%m-%d %H:%M}')
# The example displays a formatted current datetime. The datetime format specifiers follow the : character.
# This is the output.
2019-05-11 22:39
Was this helpful?
Similar Posts
- [Python] F-strings format syntax
- [Python] F-strings format syntax call functions
- Print DataFrame in pretty format in Terminal
- Python - String , Check If Word Is In string
- Python - String ,remove,delete,replace,extract numbers from string
- Python - String, renove all single character for text
- Integer to String conversion in Python