Convert javascript date time to C#/VB.NET date time

Posted by Balajikcp8 under ASP.NET on 2/18/2013 | Points: 10 | Views : 3718 | Status : [Member] | Replies : 1
I want to get client timezone so i'm using the code below
javascript
function filltime()
{
document.getElementById("hdnTime").value = new Date();
}

conversion

Dim time As Date = DateTime.ParseExact(hdnTime.Value,
"ddd MMM d HH:mm:ss UTCzzzzz yyyy",InvariantCulture)

I'm not getting exact value. Its showing server time only. But hdnTime.Value contains the correct value("Mon Feb 18 14:46:49 UTC+0530 2013").
I think the problem is with conversion.

What is the problem? How can I solve?




Responses

Posted by: Jayakumars on: 3/12/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Balaji Check this Script working perfect

following output this
===========================
Wed, 13 Mar 2013 02:34:34 GMT


<script>
function JscriptDate() {
var test = new Date();
var tt = test.toUTCString();
alert(tt);
}
</script>


Mark as Answer if its helpful to you

Balajikcp8, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response