Php DateTime

Convert Date time to timestamp:
$until_timestamp = mktime(0,0,0,$until_month,$until_day,$until_year);
$current_timestamp = mktime(date('H'),date('i'),date('s'),date('m'),date('d'),date('y'));
strtotime -- Parse about any English textual datetime description into a Unix timestamp
echo strtotime("now"), "\n";
echo strtotime("10 September 2000"), "\n";
echo strtotime("+1 day"), "\n";
echo strtotime("+1 week"), "\n";
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime("next Thursday"), "\n";
echo strtotime("last Monday"), "\n";

* 1 day timestamp = 60*60*24 = 86400
Increment One day:
$current_timestamp = ($current_timestamp + (60*60*24));
Convert timestamp to date:
$current_date = date('Y-m-d H:m:s',$current_timestamp);

No Comments

Post a Comment