Re: WebObjects 5.3.3, DST and J2SE 1.4.2
Re: WebObjects 5.3.3, DST and J2SE 1.4.2
- Subject: Re: WebObjects 5.3.3, DST and J2SE 1.4.2
- From: Baiss Eric Magnusson <email@hidden>
- Date: Sat, 10 Mar 2007 09:49:59 -0800
That's probably what Chuck Hill was originally alluding to, but I
don't understand what you both are referring to.
On input the entry person uses 6 popups to set an event date/time,
the results of that are stored in a DB type of <timestamp>, not the
one with time zone qualifier, and in the EOGenericRecord sub-class
that is retrieved as a <NSTimestamp>.
The date is shown on the calendar from a WOString, the <value>
binding is set to the <NSTimestamp> with the dateformat field set to <
%I:%M %p>, now I can change that WOString so that instead of the
<dateformat> binding it uses a <formatter> binding, with it set to
<application.timeZoneFormat>, but that doesn't change anything.
final NSTimestampFormatter timeZoneFormat = new
NSTimestampFormatter( "%I:%M %p" );
On Mar 10, 2007, at 7:34 AM, George Domurot wrote:
Baiss:
If you use a formatter when displaying your time, or within a text
field for form entry, you don't have to worry about pushing your
Timestamp into the correct zone for display. The formatter will
take care of all the adjustments for you. With the formatter you
can stick to the data as it's stored and avoid converting it into
(or out of) GregorianCalendar.
-George
On Mar 9, 2007, at 3:08 PM, Baiss Eric Magnusson wrote:
HI Mark,
Thanks for the help, I am working with those calls and I did give
up using the combined timestamp/timezone entity inside the database.
My re-construction code in the EOGenericRecord sub-class is
failing, the dates are now 3 days off and the DST is the same?
public NSTimeZone timeZoneObj() {
Number timezone = timeZone();
if ( timezone == null ) return NSTimeZone.defaultTimeZone();
int gmtOffset = timezone.intValue();
return NSTimeZone.timeZoneForSecondsFromGMT( gmtOffset );
}
public NSTimestamp eventDateTimeZone() {
GregorianCalendar gcDateTime = new GregorianCalendar();
gcDateTime.setTime( eventDate() ); // eventDate is the
<timestamp> in the database
return new NSTimestamp( gcDateTime.get(Calendar.YEAR),
gcDateTime.get(Calendar.MONTH), gcDateTime.get
(Calendar.DAY_OF_MONTH),
gcDateTime.get(Calendar.HOUR), gcDateTime.get
(Calendar.MINUTE), 0, timeZoneObj() );
}
On Mar 9, 2007, at 10:54 AM, Mark Ritchie wrote:
On 7-Mar-07, at 11:34 AM, Baiss Eric Magnusson wrote:
It seems to me that I need to go back and associate a time zone
id for all my events.
and then use this
tz = NSTimestamp.....
NSTimestamp myNSTimestamp = new NSTimestamp(year, month, day,
hour, minute, seconds, tz)
Hi Baiss!
Use caution here! As had already been pointed out, NSTimestamp
does not store time zone information. I believe that the tz
argument in all the constructors is only used to interpret the
other arguments.
Hmmm, might be my problem.
The docs say this for several of the constructors. The given
information is converted and stored as millisecond offset since
reference date in the reference timezone. That would be January
1, 1970, 00:00:00 GMT.
As Ken pointed out, you might be better of storing the local time
and the time zone so that you can reconstruct the right times.
Alternatively, you might find: timestampByAddingGregorianUnits
(int years, int months, int days, int hours, int minutes, int
seconds) useful. The docs say that it preserves time of day
across DST changes.
timestampByAddingGregorianUnits in the docs.
public NSTimestamp timestampByAddingGregorianUnits( int year, int
month, int day, int hour, int minute, int second)
Deprecated in the Java Foundation framework. Don't use this method.
The bit that I'm really interested in for your app is why the
time changes back to being correct in April. Makes me wonder if
something isn't up to date!?
That's because the <timestamp> refers to Greenwich time zone by
default and so when DST occurs there at the end of March the time
syncs back.
Hope that helps!
Mark
----
Baiss Eric Magnusson
<http://www.Track-Your-Finances.com>
<http://www.CascadeWebDesign.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Baiss Eric Magnusson <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Pascal Robert <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Baiss Eric Magnusson <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Ken Anderson <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Baiss Eric Magnusson <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Chuck Hill <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Baiss Eric Magnusson <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Mark Ritchie <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: Baiss Eric Magnusson <email@hidden>) |
| >Re: WebObjects 5.3.3, DST and J2SE 1.4.2 (From: George Domurot <email@hidden>) |