Determine if string format is "May 16, 2013" or UNIX Timestamp with Javascript

Viewed 2372

Doing some data wrangling with a large dataset. The data has a "date" field that randomly switches between a format like "1370039735000" and "May 16, 2013". So far I've converted other date fields with either

new Date("May 16, 2013")

or

new Date(NumberLong(1370039735000))

How can I tell the difference between the two using regex or some other means? I'm using MongoDB but it's all Javascript.

3 Answers
Related