Okay, for starters, you're trying to add an integer to a string. Perl will let you do this, but it reads the string until it finds something it can use as a number, then does so. That is, for your date string $oldDate, it finds "2005", uses that as the integer 2005, and adds 86400*30 to it. You need to convert your date string to some kind of number, like a Julian Day Number, do your addition, then convert it back to the string you want.
HTH,
Deane
| Eko Budiharto <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED] 07/18/2005 12:09
|
To: [email protected] cc: Subject: date/time calculation |
Hi list,
I have question. I got a piece of date data from mysql.
Just saying, the data is 2005-06-05 00:00:00
and then I would like to add it by 30 days
it is supposed to be like this
my $oldDate = "2005-06-05 00:00:00";
my $newDate = $oldDate + 86400 * 30;
but I confuse why it is not working. please help...
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com _______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
