On 2 Jul 2004, at 10:04 AM, Dave Rolsky wrote:
On Fri, 2 Jul 2004, Rick Measham wrote:

print "DTABS: " . new DateTime(month => 7, day => 1, year => 2004,
hour => 14) . "\n";

On the other hand, DateTime->new() returns the local time zone unless otherwise instructed.

No it doesn't. It uses floating.

Sorry, I should have looked closer :]


Dave, can you enlighten me as to why this is the case? Shouldn't all
constructors that don't have a time_zone attribute assume the same?
(Which I'd prefer to be local if we can get it)

Didn't I just explain why now() (and today()) use UTC? It's cause we use
gmtime(time) to get the value, so we actually know the time zone.

Yes you did .. I forgot :) But, if we know the local time zone, then can't we use gmtime(time) to get UTC and then convert it into local?


And why can't new() return a local time too unless asked for something else? Just so that all constructors return the same time zone.

While talking about local time zones, I'd like to again ask that during
the install stage, the local zone can be set/confirmed. I'm sure you
had a good reason not to do that, but I can't remember it.

No reason. Patches welcome ;)

OK, I'll get them to you soon.

I'd also like to see a class based (rather than object based) ability
to set the local time zone, probably through the import:

use DateTime local => 'Australia/Melbourne';

Then all constructors would use that as the local (default) zone.

Hmm, that's an interesting idea. How about making it something you did with DateTime::TimeZone instead of DateTime?

OK, it's better to have it in TimeZone because it's a time zone function, however as TimeZone comes in automatically when you use DateTime, can we have DateTime pass it onto TimeZone when it loads?


Same as Flavio's suggestion with the locale forwarding to DateTime::Locale's DefaultLocale() class method.

I'll send patches for your consideration on this also.

Cheers!
Rick Measham



Senior Developer
PrintSupply - Print Procurement & Supply Management
18 Greenaway Street VIC 3105
Tel: (03) 9850 3255
Fx: (03) 9850 3277
http://www.printsupply.com.au/




Reply via email to