I have a string with a date in it formatted like so: YYYYMMDDHHMMSS. I was wondering how I would convert it into a JavaScript Date object with JavaScript.
Thanks in
Primitive version:
new Date(foo.slice(0, 4), foo.slice(4, 6) - 1, foo.slice(6, 8), foo.slice(8, 10), foo.slice(10, 12), foo.slice(12, 14))
An explicit conversion of the strings to numbers is unnecessary: the Date() function will do this for you.
Date()