|
-
July 8th, 2009, 11:09 AM
#1
Convert from UTC Time zone to Local TIme Zone
Hello,
I am working on a web application which stores all Dates in GMT time zone.
When I display the dates to the user I need to display them in their local time zone.
So for example in my DB I have a date 08.07.2009 14:45:23 and this is GMT time
When the user views the page I need it to display 08.07.2009 10:45:23 .
HOw can I do that with Javascript function.
I have done some research but no luck
here is the function so far:
Code:
function ToLocalTimeZone(gmt)
{
var gmtDate = new Date(gmt);
}
according to what I'veread that shouhld automatically convert it to the local time zone on the client but it does not.
I've also tried using var localDate = gmtDate.toLocaleString();
but I still get the original date only the format has changed a bit.
Thank you very much in advance
Susan
-
July 10th, 2009, 04:46 AM
#2
Re: Convert from UTC Time zone to Local TIme Zone
To convert a date to UTC :
Code:
mydateObject.toUTCString()
To convert to GMT :
Code:
mydateObject.toGMTString()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|