[!--quoteo(post=389313:date=Jun 29 2006, 11:55 AM:name=barkster)--][div class=\'quotetop\']QUOTE(barkster @ Jun 29 2006, 11:55 AM)
why is my minute always off by one here? I'm trying to add 15 days to a date. Even if I do $t+(60*60*24*15-60) the minute never changes.
$t = time();
$timestamp_future = $t + (60*60*24*15);
$t = date("Y-m-d H:m:s",$t);
$timestamp_future = date("Y-m-d H:m:s",$timestamp_future);
Also, since mysql requires date in "Y-m-d H:m:s" how can I go from format from "Y-m-d H:m:s" to "M-d-y g:i:s" I thought I could do date("M-d-y g:i:s",$mysqlformatteddate) but of course it doesn't work.
first of all, if you're simply trying to get 15 days in the future, why don't you just do this:
echo date('Y-m-d H:m:s', strtotime("+ 15 days"));
the second question can be answered by the fact that date() takes a UNIX timestamp as the second argument, not a SQL datestamp, so you'd need to do this as well:
$mysqlformatteddate = "2006-06-29 12:27:05";
echo date('Y-m-d H:m:s', strtotime($mysqlformatteddate));
hope this helps