Byrne, Dermot wrote:
thanks, sorry if it's not clear
I'm just trying to modify a time so its correct for a different timezone . .
so firstly I change the timezone environment variable
$ENV{TZ} = 'EST5EDT';
# then i use the time&date i want changed in timelocal function
my $epochtime = timelocal($dbsec, $dbmin, $dbhour, $dbday, $dbmonth,$dbyear)
# or to give you the actual values
my $epochtime = timelocal(00, 00, 21, 3, 03, 2003)
# i.e. the time and date 21:00:00 March 3rd 2003
# $epochtime for this is 1049425200
# i pass this to localtime and format it
my $tm = localtime ($epochtime);
printf("<br>Date of epochtime prog: %02d:%02d:%02d - %02d/%02d/%02d\n",
$tm->hour, $tm->min, $tm->sec,
$tm->mday,$tm->mon+1,$tm->year+1900);
# it comes out like this
21:00:00 - 03/04/2003
it hasn't been changed
Why would it change ? If you store x in your DB and then you retrieve
x from your DB - why would you expect to get y back ?
You should store GMT/UTC time in your DB or just store the epoch time
which is UTC based. Then you can use a combination of timegm and/or
localtime to format it for the local TZ. I would never store local time
in a DB.
--
,-/- __ _ _ $Bill Luebkert ICQ=162126130
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs