473,225 Members | 1,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 software developers and data experts.

Convert UTC to Local Time

How can I convert UTC time such as 1173451235415 to a local time I can
read? Thank you

Mar 8 '07 #1
6 21150
On Mar 8, 1:46 pm, vunet...@gmail.com wrote:
How can I convert UTC time such as 1173451235415 to a local time I can
read? Thank you
gmtDate=new Date(UTC Date)

e.g.-
alert(Date(1173451235415))

Mar 8 '07 #2
On Mar 8, 3:01 pm, scripts.cont...@gmail.com wrote:
On Mar 8, 1:46 pm, vunet...@gmail.com wrote:
How can I convert UTC time such as 1173451235415 to a local time I can
read? Thank you

gmtDate=new Date(UTC Date)

e.g.-
alert(Date(1173451235415))
thank you, my problem was that 1173451235415 could not be a string.
when i parseInt(sometime), it works well. thank you very much.

Mar 8 '07 #3
On Mar 8, 3:05 pm, vunet...@gmail.com wrote:
How can I convert UTC time such as 1173451235415 to a local time I can
read? Thank you
gmtDate=new Date(UTC Date)
thank you, my problem was that 1173451235415 could not be a string.
even a string should work-
Date("1173451235415")
when i parseInt(sometime), it works well. thank you very much.
or +sometime
e.g
Date(+somtime)
Mar 8 '07 #4
On Mar 8, 4:53 pm, scripts.cont...@gmail.com wrote:
On Mar 8, 3:05 pm, vunet...@gmail.com wrote:
How can I convert UTC time such as 1173451235415 to a local time I can
read? Thank you
gmtDate=new Date(UTC Date)
thank you, my problem was that 1173451235415 could not be a string.

even a string should work-
Date("1173451235415")
when i parseInt(sometime), it works well. thank you very much.

or +sometime
e.g
Date(+somtime)
hm... i'll check the type. it could be XML too (after parsing).

Mar 8 '07 #5
In comp.lang.javascript message <11*********************@30g2000cwc.goog
legroups.com>, Thu, 8 Mar 2007 13:53:45, sc*************@gmail.com
posted:
>On Mar 8, 3:05 pm, vunet...@gmail.com wrote:
How can I convert UTC time such as 1173451235415 to a local time I can
read? Thank you
gmtDate=new Date(UTC Date)
>thank you, my problem was that 1173451235415 could not be a string.

even a string should work-
Date("1173451235415")
>when i parseInt(sometime), it works well. thank you very much.

or +sometime
e.g
Date(+somtime)
Don't post untested code; it shows that you overestimate your ability.
In IE6 at least, Date(X) ignores the value of X. See ISO 16262
sections 15.9.2 & 15.9.2.1 which seem not to agree; ECMA-262 likewise.

Calling new Date(1173451235415) does no conversion; the digits are
converted to an IEEE Double (type Number) outside the call, and that
value is copied into the newly-created Date Object.

The default conversion from Date Object to String, and some of the
explicit Methods, convert to unspecified string forms of local
date/time.

While your answer seems to have satisfied vunet's immediate need, it
will not have taught him much.

It's a good idea to read the newsgroup and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Mar 9 '07 #6
On Mar 8, 5:44 pm, Dr J R Stockton <reply0...@merlyn.demon.co.uk>
wrote:
or +sometime
e.g
Date(+somtime)

Don't post untested code; it shows that you overestimate your ability.
that wasn't untested. I tested that before replying.
In IE6 at least, Date(X) ignores the value of X. See ISO 16262
sections 15.9.2 & 15.9.2.1 which seem not to agree; ECMA-262 likewise.

you are right. It doesn't work. It just ignores the X. I tested but i
didn't notice the date it returned was today's date.

Calling new Date(1173451235415) does no conversion; the digits are
converted to an IEEE Double (type Number) outside the call, and that
value is copied into the newly-created Date Object.
but in help, it says -
new Date(dateVal)
If a numeric value, dateVal represents the number of milliseconds in
Universal Coordinated Time between the specified date and midnight
January 1, 1970.

It alerts the correct year but not the month and date.

sorry vunet, dont use these methods. They return the wrong date.

Mar 9 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: ECVerify.com | last post by:
I am trying to convert a computers local time to Pacific time, I can get it back to UTC pretty easy but I actually want to convert whatever the local time is on the computer I want to calculate...
2
by: yxq | last post by:
There are 8 bytes binary value stored date and time in Registry. 84 8B D7 DF 8B 28 C5 01 I want to convert the binary value to date using VB.NET. Dim a As FILETIME a.dwHighDateTime = 29698187...
2
by: yxq | last post by:
Hello, I found there are some date formats in the email header, for example: Fri, 23 Sep 2005 08:51:56 +0800 Sat, 17 Sep 2005 09:08:07 Wed Oct 19 13:40:23 2005 19 Oct 2005 13:40:23 +0000...
29
by: Jan | last post by:
Hi: I have an Access database that's been running (in one form or another) for a couple of different clients for a few years. Now a new client has requested that it be implemented with a SQL...
1
by: XML newbie: Urgent pls help! | last post by:
How to Convert local time(eg EST) on local machine to GMT. I am using VB.Net 2005. Then I need to subtract 1 minute(or 1-100) minute selected by the user in the combobox and pass it as start...
1
by: davelist | last post by:
I'm guessing there is an easy way to do this but I keep going around in circles in the documentation. I have a time stamp that looks like this (corresponding to UTC time): start_time =...
2
by: ZR | last post by:
Hello, I need to convert a GMT time string to local time. I can fill out a "tm" structure with the GMT time string. Are there any standard C (or OS) time functions that will allow me to do this? ...
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
8
by: deepak_kamath_n | last post by:
Hello, I have the following scenario: 1. My application receives the date from another application as a string 2. The other application is running in a different time zone as compared to my...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.