Hello

As Bill suggested, here is what I have at the moment

$startFormatted is the date that comes out of database
(formatted with DATE_FORMAT( datetime, '%S %i %H %w %m %Y'))

# I have module
use Time::localtime;

# firstly i split variable into parts
my ($sec, $min, $hour, $day, $month, $year) = split(/ +/,$startFormatted);

# but if I put into localtime function
my($localisedsec, $localisedmin, $localisedhour, $localisedday,
$localisedmonth, $localisedyear) = localtime ($sec, $min, $hour, $day,
$month, $year);

# i get 'Too many arguments for localtime ' error

when I put into localtime function like this
my($localisedsec, $localisedmin, $localisedhour, $localisedday,
$localisedmonth, $localisedyear) = localtime ($startFormatted);

# i doesn't mind however


# the statements
print $ENV{TZ};
print "<br>$startFormatted <br>";
print "$sec, $min, $hour, $day, $month, $year <br>";
print "$localisedsec, $localisedmin, $localisedhour, $localisedday,
$localisedmonth, $localisedyear";

#produce this output
CET
00 00 14 0 03 2003 
00, 00, 14, 0, 03, 2003 
0, 0, 1, 1, 0, 70

Thanx


-----Original Message-----
From: Troy Tyson [mailto:[EMAIL PROTECTED]
Sent: 27 February 2003 11:57
To: Byrne, Dermot; '[EMAIL PROTECTED]'
Subject: Re: [Perl-unix-users] changing time from database to CET?


> # I then have values for a date&time coming out of a column in the
database
> # I use a DATE_FORMAT function in the sql so my datetime comes out like
> # 2nd March 14:00
> # I thought putting this into localtime function of Time::Local module
would
> produce
> # date and CET time
>
> my $localisedstartdatetime = localtime($start);


The localtime function is looking for a the total number of seconds from the
epoch to now.  The date format from the database would be the string that
you
have documented above. A possible suggestion for fixing this would be to
break
the date up into the localtime functions individual fields and output the
number of
seconds into a variable followed by putting the output of that variable into
the line
above.


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


http://www.musicchoice.co.uk

Support Digital Media - Join EDiMA - http://www.edima.org

Music Choice Limited (company registration number 2838971) is a
company incorporated in England and Wales with its registered
office at Fleet House, 57-61 Clerkenwell Road, London EC1M 5LA.
 
**********************************************************************
Information in this email is confidential and may be privileged. It is
intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system.
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to