views:

101

answers:

1

I'm trying to convert the javascript date to ASP.NET's DateTime.Now

var todaysDate = new Date();
document.getElementById('hdnDate').value = todaysDate.toString();


private void ConvertToDotNetDateTime()
{
    DateTime myDate = (DateTime)hdnDate.Value; ??? ? //bit lost here
}
A: 

You can use DateTime.ParseExact to convert the date to DateTime.Now

You can check the Example

Azhar
-1. A lot of your answers seem to be comprised of "check the link" and that is not the point of SO - especially when the same link was already posted as a comment 40 minutes earlier.
Evgeny