php-general | 2001092
Date: 09/20/01
- Next message: Jeb Anderson Scarbrough: "[PHP] if statement"
- Previous message: Eric O'Connell: "RE: [PHP] simple question..."
- In reply to: Ker Ruben Ramos: "Re: [PHP] simple question..."
- Next in thread: * R&zE:: "Re: [PHP] simple question..."
- Reply: * R&zE:: "Re: [PHP] simple question..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<Original message>
From: Ker Ruben Ramos <kreaper <email protected>>
Date: Thu, Sep 20, 2001 at 09:36:55PM -0700
Message-ID: <012b01c14257$0afb3db0$bb05aacb <email protected>>
Subject: Re: [PHP] simple question...
> One more thing... If I got '2001-09-01'
> Is there a fast way of incrementing the month of it?
> making it '2001-10-01' ?
</Original message>
<Reply>
You should date() do the work here. So just take the month and then
+1. Date() will take care the result is a valid date.
Below is some example...
--- PHP Example Code ---
<PRE>
<?php
$myDate = "2001-09-12";
if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $myDate, $matches)) {
if (checkdate ($matches[2], $matches[3], $matches[1])) {
print (date ("Y-m-d", mktime (0,0,0,$matches[2]+1, $matches[3], $matches[1])));
} else {
print ("No valid date!");
}
} else {
print ("No valid date!");
}
?>
</PRE>
--- End of PHP Example Code ---
</Reply>
--* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze <email protected> -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Jeb Anderson Scarbrough: "[PHP] if statement"
- Previous message: Eric O'Connell: "RE: [PHP] simple question..."
- In reply to: Ker Ruben Ramos: "Re: [PHP] simple question..."
- Next in thread: * R&zE:: "Re: [PHP] simple question..."
- Reply: * R&zE:: "Re: [PHP] simple question..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

