How can I convert a string to a date time object in javascript by specifying a format string?
I am looking for something like:
var dateTime = convert
Date.parse()
is fairly intelligent but I can't guarantee that format will parse correctly.
If it doesn't, you'd have to find something to bridge the two. Your example is pretty simple (being purely numbers) so a touch of REGEX (or even string.split()
-- might be faster) paired with some parseInt()
will allow you to quickly make a date.