Search code snippets, questions, articles...

[Python] F-string format datetime

import 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
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Was this helpful?