Diegar Posted March 5, 2011 Share Posted March 5, 2011 Is there a quick and easy way to get a unix timestamp of the beginning of the day, so if i wanted a specific time, i could add that many seconds to it? Server time is fine. I can adjust it for time zone. Having trouble with this. Thanks! Link to comment Share on other sites More sharing options...
thescientist Posted March 5, 2011 Share Posted March 5, 2011 depends on what you mean by the start of the day. Using the date object you should be able to "force" a few params, like the day, date, month, and year, (by getting them from the date object) and then make a timestamp out of that by setting all the time parts to 0. or you can get info like this:http://www.w3schools.com/php/php_ref_date.asp Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2011 Share Posted March 5, 2011 You can use mktime to get the start and end of the current day (or any timestamp):$start = mktime(0, 0, 0);$end = mktime(23, 59, 59);http://www.php.net/manual/en/function.mktime.php Link to comment Share on other sites More sharing options...
thescientist Posted March 5, 2011 Share Posted March 5, 2011 haha, I forgot about that one. I'm so used to Javascript I keep forgetting how many functions PHP has! Link to comment Share on other sites More sharing options...
Diegar Posted March 5, 2011 Author Share Posted March 5, 2011 You can use mktime to get the start and end of the current day (or any timestamp):$start = mktime(0, 0, 0);$end = mktime(23, 59, 59);http://www.php.net/manual/en/function.mktime.php That is exactly what i was looking for.. thank you for breaking it down so easily Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.