I am passing a variable ($emailt) that is a number of hours to a PHP page that then sends an email. I want to add the current time to the number of hours variable and send it in the email. The variable is usually either 12 or 24 .
If the current time is 7:05 pm I want to add 12 so that the variable would read 7:05am. What I have so far is giving me 7:00 am and no exact minutes.
How do I add the two times together correctly?
$time = date("g:i a");
$emailt = ($emailt*3600+$time);
echo date("g: i a",$emailt) ;
***never mind, misread the original post...let me think a minute***
OK, I think you just want to use the current value of time() as a UNIX timestamp integer, then only use date() when you output it in human-readable format:
$emailt = ($emailt * 3600 + time());
echo date("g: i a", $emailt) ;
Thanks NogDog, that worked!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)