I have string value like "26-APR-2019 16:40". I want to convert this in to date time in java script. Please help me.
Asked
Active
Viewed 191 times
-2
-
This datetime string format is not supported. You'll have to split the string into it's parts yourself. And convert APR into a valid month name some way. – Shilly Apr 26 '19 at 11:29
-
1I recommend you to use moment.js https://momentjs.com/ – ProblemsEverywhere Apr 26 '19 at 11:29
-
1Where are you getting the string? If possible, fix the source to pass a valid date for JS. – Teemu Apr 26 '19 at 11:31
1 Answers
0
You can't use the Date.parse() function to parse your string into a date object. Your string is not compatible with this function you will have to parse the sting manually with some switch case operations.