Being a complete non programmer, i thought it would be a good idea to help others like me who have no programming knowledge but want to develop web based applications. Additionally i wanted to be able to access all these for my own repetitive use.
Monday, December 19, 2011
add or subtract time in php
<?php
date_default_timezone_set('Asia/Dubai');
$rightnow = date('d-m-Y H:i:s');
echo "The time right now is $rightnow";
echo "<br />";
$after = 1200 + time();
$timeafter = date('d-m-Y H:i:s',$after);
echo "The time after 20 minutes will be $timeafter";
echo "<br />";
$before = time() - 1200;
$timebefore = date('d-m-Y H:i:s',$before);
echo "The time 20 minutes ago was $timebefore";
?>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment