The string can be got by getFullYear and so on.
Can it be done reversely?
Replace -
by /
and JavaScript can parse it. Stupid mistake in JS specification (ISO date/time standard is very clear that -
is correct)
var str = "2010-1-10";
alert(Date.parse(str.replace(/-/g,"/")));
Try pasting it in your browser: javascript:alert(Date.parse("2010-01-01".replace(/-/g,"/")));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With