Hello, I am using the following code to take 15 minutes from the current date/time $minus = -900; $nowtimeanddate = date("Y-m-d H:i:s"); $nowtimeanddate15 = time($nowtimeanddate) + ($minus); $nowtimeanddate15 = date("Y-m-d H:i:s", $nowtimeanddate15); Code (markup): This works fine but I am trying to use the same thing to process a date submitted by a user but instead of getting changes made to the user's date, I get the time/date now plus/minus whatever variation I feed in. Anyone see what I'm doing wrong? Here's what I've got: $thisdate = $_POST['nojsyear']."-".$_POST['nojsmonth']."-".$_POST['nojsday']; $thistime = $_POST['stt_hour'].":".$_POST['stt_minute'].":".$_POST['stt_seconds']; $alltimedate = $thisdate." ".$thistime; $alltimedate = strtotime($alltimedate); $alltimedate = date("Y-m-d H:i:s", $alltimedate); $alltimedateUpdated = time($alltimedate) + ($minus); $alltimedateUpdated = date("Y-m-d H:i:s", $alltimedateUpdated); Code (markup): Any help will be greatly appreciated.
why $alltimedateUpdated = date("Y-m-d H:i:s", $tweettimedateUpdated); Code (markup): shouldnt it be $alltimedateUpdated = date("Y-m-d H:i:s", $alltimedateUpdated ); Code (markup):
Yeah, you're right. But that was a mistake in explaining the problem, in my actual code I have $alltimedateUpdated edit: for the purpose of clarity, I have corrected my original post
$minus = -900; $nowtimeanddate = date("Y-m-d H:i:s"); $nowtimeanddate15 = date("Y-m-d H:i:s", time() + $minus); Code (markup):
That is for the time and date now minus 15 minutes. I want to use a date stored in a variable rather thasn the time and date right now minus 15 mins. Make sense?
Well, you can subtract 900 from any number you like. If your time is stored as a unix timestamp (integer) just subtract 900 from it. If it's stored in Y-m-d H:i:s, then strtotime it first. Maybe I am missing something which is making this more complicated than it seems to me.