Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save harveyqing/9592471 to your computer and use it in GitHub Desktop.
Save harveyqing/9592471 to your computer and use it in GitHub Desktop.
Re. match `2014-03-17 09:33:59` format like timestramp
import re
tp = re.compile(r'^(\d{4})-([1-9]|0[1-9]|1[0-2])-([1-9]|[1-2]\d|3[0-1]) (\d|0\d|1[0-2]|1\d|2[0-3]):(\d|[0-5]\d):(\d|[0-5]\d)$')
# can match string timestamps like below
# t1 = '3003-1-1 9:03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment