473,656 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 21188
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(1173 451235415))

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(1173 451235415))
thank you, my problem was that 1173451235415 could not be a string.
when i parseInt(someti me), 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("117345123 5415")
when i parseInt(someti me), 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("117345123 5415")
when i parseInt(someti me), 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.javas cript message <11************ *********@30g20 00cwc.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("11734512 35415")
>when i parseInt(someti me), it works well. thank you very much.

or +sometime
e.g
Date(+somtim e)
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(1173451235 415) 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.c om/faq/index.html>.
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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...@merl yn.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(1173451235 415) 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
5789
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 what it would currently be in Pacific time. Taking in account Daylight Savings Time Thanks, Ed,
2
9564
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 '(01C5288B to decimal) a.dwLowDateTime = -539522172 '(??????? by 84 8B D7 DF) MsgBox (GetFileToSystemDate(a, False))
2
4948
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 19 Oct 2005 13:40:23 -0400
29
2628
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 server back-end. I'm doing my best to learn about SQL server, and I plan to leave the front-end more or less as-is, just linking to the SQL server back end, but here's a basic question: The db has a front-end linked to two back-ends. One of the...
1
8417
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 time to the query. I thanku all in advance.
1
14588
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 = '2007-03-13T15:00:00Z' I want to convert it to my local time. start_time = time.mktime(time.strptime(start_time, '%Y-%m-%dT%H:%M:
2
18216
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? "subtracting ### hours depending on the locale" is not an option because I need this to work on any machine anywhere in the world, unless there is a way to get the ### (from OS or machine using a standard C or C++ system function calls).
1
3591
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 some files and work on it. Let say, I want add new page to web project named websiteOrder.sln, i will open websiteOrder.sln in my local computer, connected to websiteOrder.sln located in Visual Source Safe 6.0(source safe located in another...
8
6045
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 app. 3. I need to convert the received date string in to a date w.r.t my local time zone.
0
8297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8498
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1600
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.