I get from my client a date in this format:
2012-11-07T00:00:00 (yyyy-mm-ddT00:00:00)
How can I parse it into a Date object?
My first option is:
- getting the first 10 characters (2012-11-07)
- split that by “-“
- creating new Date(splitted[0],splitted[1],splitter[2])
I know that such a question is obvious and over-answered, not only in Stack Overflow, but I want to:
- know a better practice WITHOUT any library, pure JS ( Date.parse() ? )
- the same with a widely used date library / framework for nodeJS
1 Answer