note 108191 added to function.time
| From: | relentless2712 at gmail dot com | Date: | Thu, 05 Apr 2012 20:37:12 +0000 |
| Subject: | note 108191 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186989@lists.php.net to get a copy of this message | ||
-- RE: holdoffhunger at gmail dot com --
An easy way to find the timestamp for the following month is to use mktime!
<?php
$old_timestamp = 1331835943; // Thurs 15th May 2012
$my_month = date("m",$old_timestamp)+1;
$my_year = date("y",$old_timestamp);
/*
it doesnt matter if $my_month is 13. mktime will automatically, adjust the year accordingly
*/
$new_timestamp = mktime(0,0,0,$my_month,1,$my_year);
//Result: $new_timestamp = 1333256400 (Sun, 1 Apr, 2012)
?>
Or, for simplification purposes;
<?php
$old_timestamp = 1331835943; // Thurs 15th May 2012
$new_timestamp =
mktime(0,0,0,date("m",$old_timestamp)+1,1,date("y",$old_timestamp));
//1333256400 (Sun, 1 Apr, 2012)
?>
----
Server IP: 69.147.83.197
Probable Submitter: 90.218.66.81
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- https://master.php.net/note/edit/108191
Del: integrated -- https://master.php.net/note/delete/108191/integrated
Del: useless -- https://master.php.net/note/delete/108191/useless
Del: bad code -- https://master.php.net/note/delete/108191/bad+code
Del: spam -- https://master.php.net/note/delete/108191/spam
Del: non-english -- https://master.php.net/note/delete/108191/non-english
Del: in docs -- https://master.php.net/note/delete/108191/in+docs
Del: other reasons-- https://master.php.net/note/delete/108191
Reject -- https://master.php.net/note/reject/108191
Search -- https://master.php.net/manage/user-notes.php