Created
February 24, 2020 07:48
-
-
Save Granitosaurus/fdbaac3fe2703e1af5e0beb6148bec30 to your computer and use it in GitHub Desktop.
Infer date format from date string in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
somedate = '2020-02-24 07:22' | |
somedates = ['2020-02-24 07:22', '1995-12-01 22:00', '2001-01-01 11:54'] | |
import dateinfer | |
print(dateinfer.infer(somedate) | |
#'%H' incorrect | |
print(dateinfer.infer(somedates) | |
#'%Y-%m-%d %H:%M' correct! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment