On Fri, 27 Jul 2001, Brian Jefferies wrote:
>
> Is it possible to to create a new Time::Object with a time other than current?
>
> I have used the example including with the module...
> $t = localtime;
>
> I would like to set $t to an arbitrary time, for example...
> $u = 6/1/2001;
>
> I'm using Time::Object because it seemed the easiest to use figure out tomorrow,
>yesterday, etc.
In order to create a time object with a different time, you call
localtime with a different argument. Time::Object just overrides
localtime.
So, you could do something like:
use Time::Object;
$t = localtime(12345);
print $t->year;
So this is less than convenient of you just have a string like
'6/1/2001'. Try, perhaps, Time::ParseDate:
use Time::ParseDate;
use Time::Object;
my $date = parsedate("6/1/2001");
my $t = localtime($date);
--
Rich Bowen - [EMAIL PROTECTED]
http://www.rcbowen.com/kenya/