Skip to content

Instantly share code, notes, and snippets.

@momota
Created February 6, 2020 15:42
Show Gist options
  • Save momota/08c170ce9f804d96ea0d3aee5edb3bb7 to your computer and use it in GitHub Desktop.
Save momota/08c170ce9f804d96ea0d3aee5edb3bb7 to your computer and use it in GitHub Desktop.
get datetime with 0 padding
import datetime
now = datetime.datetime.now()
now_str = now.strftime('%Y-%m-%d-%H-%M')
year, month, day, hour, minute = now_str.split('-')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment