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 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: 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 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/