php - Getting midnight timestamp value from specific timestamp -
i want calculate midnight value timestamp. example 1461043742 today's timestamp, want timestamp of midnight 12'o clock timestamp value. , 1461130928 tomorrow's timestamp want show tomorrow midnight 12'o clock timestamp value. how can this, there possibility achieve in php?
you can use strtotime
:
// input: $now = 1461043742; // calculate: $midnight = strtotime("midnight", $now); $midnight_tomorrow = strtotime("midnight tomorrow", $now); // test print(date('c', $midnight)); print(date('c', $midnight_tomorrow));
Comments
Post a Comment