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?

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 2013-05-26 14:23 +0200
Message-ID <b0ed5tFmpoiU1@mid.individual.net> (permalink)
References <9aa4dbef-0212-4823-9b31-1a6d54ee772c@googlegroups.com>

Show all headers | 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