1

I got data from JSON now I want to determine whether the data is timestamp or not. But it is not a datetime object, it is string. How can I do this?

  • 1
    Please post some code you have tried, and some example data. – thaavik Aug 10 '17 at 13:46
  • Try this https://stackoverflow.com/questions/25341945/check-if-string-has-date-any-format – Aneef Aug 10 '17 at 13:47
  • Possible duplicate of [Check if string has date, any format](https://stackoverflow.com/questions/25341945/check-if-string-has-date-any-format) – m_____z Aug 10 '17 at 13:51

2 Answers2

0

Use dateutil.parser.parse to convert arbitrary timestamp-like strings to date objects.

thaavik
  • 3,257
  • 2
  • 18
  • 25
0

I solved my problem with regex. re.match(pattern,str) function.