Re: Date format question
| From: | Philip Olson | Date: | Tue, 16 Oct 2001 02:29:42 +0000 |
| Subject: | Re: Date format question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71162@lists.php.net to get a copy of this message | ||
Consider the strtotime() function :
$a = 20011015;
$b = strtotime($a) + (60*60*24*14);
print date('Y-m-d',$b);
It's quite nice. If this data is coming from a database, look at the
database's date functions. For example, MySQL date functions can be seen
here :
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
Regards,
Philip Olson
On Mon, 15 Oct 2001, Don wrote:
> Hi,
>
> I have a date string in the following format: yyyymmdd. So today's
> date would show as 20011015
>
> What I want to do is add 14 days to the date (month and year changes
> are verified) and produce output that looks like, mmm-dd-yyyy as in:
> Oct-29-2001 (I know I can use the "date()" function to accomplish the
> latter.
>
> Does anyone have a function that does the above?
>
> Thanks,
> Don
>