-1

I need to convert date mm/dd/yyyy to JavaScript date to be used in JSON. The date is Dec 02 2016 and the JavaScript date will be 1480636800000. I need to convert this date to a JavaScript date.

rbento
  • 9,919
  • 3
  • 61
  • 61
  • Possible duplicate of [DateTime to javascript date](http://stackoverflow.com/questions/2404247/datetime-to-javascript-date) – Taleeb Dec 05 '16 at 11:20
  • 1
    *WHY* are you trying to generate a JSon string manually instead of using JSon.NET or another Json serializer? What you posted is *NOT* a valid Json date. Valid JSON dates follow the ISO8601 format. – Panagiotis Kanavos Dec 05 '16 at 11:53

1 Answers1

0

In javascript the date start from

Thu Jan 01 1970 00:00:00

which is equalent to 0

So the time is counted in javascript is in milliseconds. By Logic if you can get the days count between this date and the date which you want to convert into milliseconds.

so there is a function in vb.net to get the days difference which is you can check this link

as there is

1000 * 60 * 60 * 24 millisecond are there in one day

So by this you can calculate the time in milliseconds.

Vivek Sharma
  • 164
  • 1
  • 8