Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #24182

Re: Possible to treat time in milliseconds as a different time zone?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Possible to treat time in milliseconds as a different time zone?
Date Sun, 26 May 2013 14:23:19 +0200
Lines 33
Message-ID <b0ed5tFmpoiU1@mid.individual.net> (permalink)
References <9aa4dbef-0212-4823-9b31-1a6d54ee772c@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net 0N8i9jU4mlbtn4qhM6OzZgXuwsTsINs0iOhv+NSDKUtAUHzZk=
Cancel-Lock sha1:dzuNtMOxzndIl7P9t3rkjZK1mF0=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
In-Reply-To <9aa4dbef-0212-4823-9b31-1a6d54ee772c@googlegroups.com>
X-Antivirus avast! (VPS 130526-0, 26.05.2013), Outbound message
X-Antivirus-Status Clean
Xref csiph.com comp.lang.java.programmer:24182

Show key headers only | View raw


On 21.05.2013 16:58, laredotornado@zipmail.com wrote:

> I'm using Java 6.  I'm trying to see if there's a simple way to
> convert a long varaible (the number of milliseconds since 1970) to a
> timezone other than GMT.

As others have said already that is not necessary.  You need to 
distinguish two concepts:

1. point in time: this is represented by a number of milliseconds since 
a particular point in time in history.

2. representation of a point in time for various audiences (language, 
time zone).

Ideally internally to an application you use concept number 1 _all_ the 
time and make use of concept 2 when appropriate (e.g. when presenting a 
point in time to the user or writing it into a logfile).

> Can I parse the time zone string to get the number of hours
> difference and then just add that?  Grateful for any elegant
> solutions.

You can - but it's the wrong approach.

Cheers

	robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Possible to treat time in milliseconds as a different time zone? laredotornado@zipmail.com - 2013-05-21 07:58 -0700
  Re: Possible to treat time in milliseconds as a different time zone? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-21 11:23 -0400
  Re: Possible to treat time in milliseconds as a different time zone? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-21 11:31 -0400
  Re: Possible to treat time in milliseconds as a different time zone? Stanimir Stamenkov <s7an10@netscape.net> - 2013-05-21 23:09 +0300
  Re: Possible to treat time in milliseconds as a different time zone? Nigel Wade <nmw@ion.le.ac.uk> - 2013-05-22 10:00 +0100
    Re: Possible to treat time in milliseconds as a different time zone? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2013-05-22 13:08 +0300
      Re: Possible to treat time in milliseconds as a different time zone? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-22 16:46 +0200
  Re: Possible to treat time in milliseconds as a different time zone? Roedy Green <see_website@mindprod.com.invalid> - 2013-05-22 03:03 -0700
  Re: Possible to treat time in milliseconds as a different time zone? Robert Klemme <shortcutter@googlemail.com> - 2013-05-26 14:23 +0200
  Re: Possible to treat time in milliseconds as a different time zone? Michal Kleczek <michal_wytnijto@kleczek.org> - 2013-05-27 11:45 +0200

csiph-web