0

I have a Web Api returning a datetime feild as below I know its unix stamp , And I can convert it if i consider the numeric part only

"InvoiceDate":"/Date(1590696000000)/"

Can anyone suggest me to directly convert the above to date variable in javascript

NB. I had already done enough search on stackoverflow. but cannot find a question close enough for the same format.so posted considering somebody with same query in future too

4
  • this should help w3schools.com/js/tryit.asp?filename=tryjs_date_new_millisec Commented May 29, 2020 at 14:19
  • you can use the eval function, however the starting and ending / has to be removed Commented May 29, 2020 at 14:26
  • Looks like your web api is .net / c# - do you have an option to change the web api? It's much cleaner/easier than hacking the json return. Commented May 29, 2020 at 14:45
  • 1
    new Date(+(InvoiceDate.match(/\d+/) || [])[0]) Commented May 30, 2020 at 1:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.