Erm... I think we may both be 'right' this time (^_^)
GregorianCalendar gc = new
GregorianCalendar(2009,2,13,14,36,45);
GregorianCalendar gc1 = new
GregorianCalendar(2009,2,13,14,36,45);
TimeZone pst = TimeZone.getTimeZone( "PST" );
TimeZone est = TimeZone.getTimeZone( "EST" );
gc.setTimeZone( est );
gc1.setTimeZone( pst );
System.out.println(gc.getTimeInMillis());
System.out.println(gc1.getTimeInMillis());
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy
hh:mm:ss a");
gc.setTimeZone( pst );
sdf.setTimeZone( pst );
System.out.println(sdf.format( gc.getTime() ));
gc.setTimeZone( est );
sdf.setTimeZone( est );
System.out.println(sdf.format( gc.getTime() ));
1236969405000
1236980205000
03/13/2009 11:36:45 AM
03/13/2009 02:36:45 PM
So, it does used fixed gregorian units... until you give it a
timezone. Once that happens, the units are recalculated when updating
the time zone, not the time.
*facepalm*
Ramsey
On Oct 1, 2010, at 3:05 PM, Chuck Hill wrote:
On Oct 1, 2010, at 11:54 AM, Ramsey Gurley wrote:
Aaaaand, I'm wrong
GregorianCalendar gc = new
GregorianCalendar(2009,2,13,14,36,45);
TimeZone pst = TimeZone.getTimeZone( "PST" );
TimeZone est = TimeZone.getTimeZone( "EST" );
gc.setTimeZone( pst );
System.out.println(gc.getTimeInMillis());
gc.setTimeZone( est );
System.out.println(gc.getTimeInMillis());
gives me output of:
1236980205000
1236980205000
Those numbers are the same which suggests that it IS ignoring the
time zone. But that might be in GMT. Formatting to human readable
may yield different results.
D'oh! I'll go back to *not* thinking about dates again. (^_^)
Word to the wise... Chuck Hill is always right.
I just wish someone could convince my wife of that!
On Oct 1, 2010, at 1:29 PM, Ramsey Gurley wrote:
My understanding of the GregorianCalendar class is that unlike
Date, it stores the gregorian units as the fixed value and the
value of getTime is calculated based on the units and the time
zone. So it doesn't matter if you set the timezone to Fiji time
or PST, it will still tell you 12/31/2010 @ 2:00 pm. It only
computes the gregorian units if you setTime. Perhaps I'm wrong
about that... but it does bring up the problem of mutable data
types...
Ramsey
On Oct 1, 2010, at 12:58 PM, Chuck Hill wrote:
The problem is that GregorianCalendar still has a time zone which
is what most people seem to want to avoid with date only values.
Otherwise, really, you need a geographically referenced point in
time.
On Oct 1, 2010, at 9:00 AM, Ramsey Gurley wrote:
On Oct 1, 2010, at 11:33 AM, Ray Kiddy wrote:
On Sep 30, 2010, at 12:12 PM, Mike Schrag wrote:
Calendar dates should not be represented by NSTimestamp.
The Date prototype is wrong for using it IMHO.
i couldn't agree more. but where do we go from here ?
1) leave the mysql date prototype as it is now, broken and
unusable
If it is broken, then either no one is using it, or they are
using it in a way that your change would break.
We should have unit tests for testing things like that, on
most popular databases (MySQL, PostgreSQL, FrontBase, H2 and
Oracle DB Express).
i think i heard a volunteer!
ms _______________________________________________
There is a place to start. I created an example app called
TickTockMan. It is in Wonder, so it could be added to. When I
created it, the response was deafening. Or I assume it was,
because I found myself to be deaf. Or there was silence. One of
those.
And lots of people have talked, over the years, about a
NSWallClockTime/Date class, one that could capture the
situation where I look at the clock and see a "2:00" and I want
to discuss it with someone else who can look at another clock,
regardless of what time zone they are in. Does anyone already
have code for that they are planning to check in to Wonder? I
have a class, but I am sure others will find it quirky.
- ray
I have every intention of creating a calendarDate prototype as
soon as I figure out how to interact with it in the UI. It will
probably be something like
GregorianCalendar->ERXGregorianCalendar (Subclassed to supply
factory methods)
&
SimpleDateFormat->ERXCalendarFormat (Subclass to translate date
strings entered into an ERXGregorianCalendar)
&
calendarDate prototype with an external type like dateTime to
store the data in a way the database can compare. I assume that
means it will be normalized to a constant time zone like GMT.
And I may make another based on XMLGregorianCalendar for those
of us working with JAX-WS web services... But if someone wants
to build and test all that for me, I'll welcome it (^_~)
Ramsey
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
This email sent to ch...@global-village.net
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/ramsey%40xeotech.com
This email sent to ram...@xeotech.com
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com