-2

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.

user1463065
  • 489
  • 1
  • 9
  • 26
  • 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
  • 1
    I recommend you to use moment.js https://momentjs.com/ – Drusto Apr 26 '19 at 11:29
  • 1
    Where 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 Answers1

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.