using date

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mccommunity
Forum Commoner
Posts: 62
Joined: Mon Oct 07, 2002 8:55 am

using date

Post by mccommunity »

I wrote this function and I want it to display like this 2003-11-30 but right now it is displaying like this 1072760400 how do I format this? This is my function:


function expire_date($months)
{
$date = mktime (0,0,0,date("m")+$months,date("d"), date("Y"));
return $date;
}



Thanks
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

Code: Select all

<?php
function expire_date($months) 
{ 
$date = mktime (0,0,0,date("m")+$months,date("d"), date("Y"));
return date("Y-m-d", $date);
}
?>
read more about [php_man]date[/php_man] at php.net.
Post Reply