Click here to Skip to main content
Sign Up to vote bad
good
See more: C#ASP.NET
how can i display current date and time in my application as per respected time zones.
For example, if i open my app in INDIA,it should show indian current time.same in other time zones. My application is now displaying US time because the application hosted in USA servers.Please help me out. Thanx in Advance
Posted 23-Jan-13 2:26am


1 solution

I am assuming that you are asking about a web-based application.
 
Use of the JavaScript Date Object may solve your issue. You can write some JavaScript code that runs on the client PC to compute the local time from the GMT.
 
// Generate the following JavaScript line on the server
// inserting the GMT date and time.
// In this example: GMT = 23 January 2013 16:15
var theDate = new Date(2013,01,23,16,15,0,0); 
 
// The above line creates the Date object.
// The following line converts the Date object to a local time zone string.
var myLocalDate = theDate.toLocaleString();
 
Note: I have not tested this solution. I just read my JavaScript manual to learn about the Date object and compose my suggested solution.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 6,824
1 Prasad_Kulkarni 3,671
2 _Amy 3,312
3 OriginalGriff 3,309
4 CPallini 2,925


Advertise | Privacy | Mobile
Web02 | 2.6.130617.1 | Last Updated 23 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid