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


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

Timezone string and converting dates to my time zone

From laredotornado <laredotornado@zipmail.com>
Newsgroups comp.lang.java.programmer
Subject Timezone string and converting dates to my time zone
Date 2011-07-06 13:35 -0700
Organization http://groups.google.com
Message-ID <dd846e8a-836e-404a-ae4b-7eb634711b73@29g2000yqb.googlegroups.com> (permalink)

Show all headers | View raw


Hi,

I'm using Java 1.6.  I'm trying to convert a date that is of a
different time zone than what my machine is and I'm trying to get an
equivalent java.util.Date object for my time zone.  So I'm trying ...

	public void setLEAD_ENTRY_DATE(Date lEAD_ENTRY_DATE) {
		final Calendar cal = Calendar.getInstance();
		final String tz =
EnvironmentProperties.getInstance().get("database_time_zone").trim();
		cal.setTimeZone( TimeZone.getTimeZone(tz) );
		cal.setTime( lEAD_ENTRY_DATE );
		this.LEAD_ENTRY_DATE = cal.getTime();

but this isn't working (time passed in is the same as what I get
back).  The time zone string is, "GMT-5:00", and I'm in central
standard time (GMT-6:00).  Any hints on how to get this right are
greatly appreciated, - Dave

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

Timezone string and converting dates to my time zone laredotornado <laredotornado@zipmail.com> - 2011-07-06 13:35 -0700
  Re: Timezone string and converting dates to my time zone markspace <-@.> - 2011-07-06 14:02 -0700
  Re: Timezone string and converting dates to my time zone Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-07-07 09:27 +0100
  Re: Timezone string and converting dates to my time zone Roedy Green <see_website@mindprod.com.invalid> - 2011-07-08 00:56 -0700

csiph-web