Jump to content

Archived

This topic is now archived and is closed to further replies.

djones

Date comparison help wth mktime

Recommended Posts

I'm pulling $date_created from the database. It is in this format: March-10-2006-10-55-22. I need to echo the $date_created plus 5 days from it. All works ok BUT I need to keep the original hours, minutes, and seconds. How can I do this? How do I add variables into the mktime below?

[code]
echo "Date Created: ".$date_created."<br />";

$split_date = split("-", $date_created);

//EX of $date_created :: date("F-j-Y-g-i-s") = March-10-2006-10-55-22

$second = $split_mydate[5];   // :22
$minute = $split_mydate[4];   // :15:
$hour = $split_mydate[3];   // 10:

$year = $split_mydate[2];   // 2006
$day = $split_mydate[1]; // 10
$month = $split_mydate[0];  // March


//Need to keep the original hours, minutes, and seconds from above. How do I add it in mktime?
$tomm  = date("F-j-Y-g-i-s", mktime(0, 0, 0, date("m"), date("d")+5, date("Y")));
echo "<br/>".$tomm;
[/code]

Share this post


Link to post
Share on other sites
I finally figured it out. Please close.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.