I googled around and found couple of javascript codes to determine current date and time. But I noticed these samples are not returning correct time.
I want javascript code to return accurate date and time in the format: yyyy-mm-dd hh:mm:ss.
I also want this function to be called in asp.net content form load and store the result in hidden field.
I tried calling the script on content page load, but it doesn't work. But when I bind it with OnClientClick event of a button, it successfully stores in asp.net hidden field.
rpk2006
Member
631 Points
629 Posts
How to accurately determine system date and time and store the result in a hidden field?
Dec 05, 2012 05:23 PM|LINK
I googled around and found couple of javascript codes to determine current date and time. But I noticed these samples are not returning correct time.
I want javascript code to return accurate date and time in the format: yyyy-mm-dd hh:mm:ss.
I also want this function to be called in asp.net content form load and store the result in hidden field.
I tried calling the script on content page load, but it doesn't work. But when I bind it with OnClientClick event of a button, it successfully stores in asp.net hidden field.
Afzaal.Ahmad...
Contributor
2660 Points
1039 Posts
Re: How to accurately determine system date and time and store the result in a hidden field?
Dec 05, 2012 05:44 PM|LINK
Did you try DateTime.Now ?? Try this out in a variable like
~~! FIREWALL !~~
rpk2006
Member
631 Points
629 Posts
Re: How to accurately determine system date and time and store the result in a hidden field?
Dec 05, 2012 06:13 PM|LINK
Is it a javascript code you are suggesting? I need a javascript code.
raju dasa
Star
14392 Points
2447 Posts
Re: How to accurately determine system date and time and store the result in a hidden field?
Dec 06, 2012 05:22 AM|LINK
Hi,
Check this post:
http://forums.asp.net/post/set/130/1863797/5230558
and just change its date order.
rajudasa.blogspot.com || blog@opera
Afzaal.Ahmad...
Contributor
2660 Points
1039 Posts
Re: How to accurately determine system date and time and store the result in a hidden field?
Dec 06, 2012 09:08 AM|LINK
yes DateTime.Now is a javascript
And variable is itself introduced by JavaScript
~~! FIREWALL !~~
rpk2006
Member
631 Points
629 Posts
Re: How to accurately determine system date and time and store the result in a hidden field?
Dec 06, 2012 04:39 PM|LINK
In my case it is giving error: "DateTime is undefined".
roopeshreddy
All-Star
20143 Points
3327 Posts
Re: How to accurately determine system date and time and store the result in a hidden field?
Dec 07, 2012 04:04 AM|LINK
Hi,
Check this sample code -
Hope it helps u...
Roopesh Reddy C
Roopesh's Space