I want to display date and time in my application ,where clients should see their local time .Any one who uses the website should see his or her local time globally
I am developing my application in visual studio 2003 and c#.Please help me guys to work out this task.
function displayTime()
{
var localTime = new Date();
var year= localTime.getYear();
var month= localTime.getMonth() +1;
var date = localTime.getDate();
var hours = localTime .getHours();
var minutes = localTime .getMinutes();
var seconds = localTime .getSeconds();
var div=document.getElementById("div1");
div.innerText=year+"-"+month+"-"+date+" "+hours+":"+minutes+":"+seconds;
}
shashikantht
Member
568 Points
182 Posts
How to get client date time
Apr 15, 2008 07:11 AM|LINK
Hi
I want to display date and time in my application ,where clients should see their local time .Any one who uses the website should see his or her local time globally
I am developing my application in visual studio 2003 and c#.Please help me guys to work out this task.
Shashi.
Denis Chiochiu
Participant
932 Points
198 Posts
Re: How to get client date time
Apr 15, 2008 08:07 AM|LINK
I would use a flash clock. It will show the client's time.
Denis Radoiu
---------------------------------
If you found this useful, please mark it as an answer. Thank you.
chandana
Participant
1295 Points
361 Posts
Re: How to get client date time
Apr 15, 2008 08:22 AM|LINK
You can use java script function to show date and time.
var localTime = new Date();
var hours = localTime .getHours();
var minutes = localTime .getMinutes();
var seconds = localTime .getSeconds();
You can get the hours,minutes and second from above method.
Hua-Jun Li -...
All-Star
75934 Points
5608 Posts
Moderator
Microsoft
Re: How to get client date time
Apr 17, 2008 02:50 AM|LINK
Hi shashikantht,
Please use the javascript to implement it.
<script type="text/javascript">
function displayTime()
{
var localTime = new Date();
var year= localTime.getYear();
var month= localTime.getMonth() +1;
var date = localTime.getDate();
var hours = localTime .getHours();
var minutes = localTime .getMinutes();
var seconds = localTime .getSeconds();
var div=document.getElementById("div1");
div.innerText=year+"-"+month+"-"+date+" "+hours+":"+minutes+":"+seconds;
}
</script>
Then you can display it at web page.
<body onload="displayTime();">
<form id="form2" runat="server">
<div id="div2"></div>
</form>
</body>
Let me know if I have misunderstood what you mean.
Thanks.
Hope it helps,
Hua Jun
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework