python get date format from string