I was hoping one of you guys might be able to help me. I am a bit stuck and I am very new to javascript.
I need to post a DateTime value (as c# ticks) to a webservice call from a mobile application. The mobile application is written in html/javascript.
Currently I have code that works for a normal Date. It is as follows.
function getTicksFromDatePicker(value) {
var dateparts = value.split("-");
//date format(Fullyear,month,date)
var startDate = new Date(dateparts[0], (dateparts[1] - 1).toString(),
(dateparts[2]).toString());
var ret = ((startDate.getTime() * 10000) + 621355968000000000);
if (isNaN(ret)) {
ret = 1;
}
return ret;
}
This code works perfectly if I use a normal html < input type="date" > and pass its value to my function.
I need to write a function which takes the value from an input of type="datetime" and convert it into c# ticks. I am having trouble doing so. I googled around but I did not find anything on how to. I would greatly appreciate any help you guys can provide me with.
Date.parseto convert your date string to aDate.