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.
Asked
Active
Viewed 525 times
-1

rbento
- 9,919
- 3
- 61
- 61

ajazsiddiqui
- 29
- 7
-
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 Answers
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
-
This is not a valid Json date. The OP should use a Json serializer instead of trying to construct a JSon string by hand – Panagiotis Kanavos Dec 05 '16 at 11:55