Jocka Posted December 8, 2006 Share Posted December 8, 2006 Now I THOUGHT this would work to capture the start and end of day time but it's not working properly.[code]$today['am'] = mktime(0,0,0,$month,$i,$year);$today['pm'] = mktime(11,59,59,$month,$i,$year);[/code]I want from 12:00 am to 11:59pm of he day obviously. But it's not capturing everything for some reason. I did an echo statement from a calendar of mine and it shows this:[code]Decemeber 7th:am=1165471200pm=1165514399December 8th:am=1165557600pm=1165600799[/code]you see the gap between 12/7 PM and 12/8 AM ? Obviously theres a problem there. I'm trying to use this to capture data out of the database by finding everything between $today['am'] AND $today['pm'] but with all the missing number inbetween, i'm having issues with it. Link to comment Share on other sites More sharing options...
Jocka Posted December 8, 2006 Author Share Posted December 8, 2006 ok I found that if I add 43,200 to $today['am'] number then it adds up right but there has to be a better way? Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 8, 2006 Share Posted December 8, 2006 Try it this way:[code]<?php$today = array();$today['am'] = strtotime($month . '/' . $i . '/' . $year . ' 12:00:00 am');$today['pm'] = strtotime($month . '/' . $i . '/' . $year . ' 12:59:59 pm');echo '<pre>' . print_r($today,true) . '</pre>';?>[/code]Ken Link to comment Share on other sites More sharing options...
Jocka Posted December 8, 2006 Author Share Posted December 8, 2006 had to change that to 11:59:59 but it worked. Thanks :) Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 8, 2006 Share Posted December 8, 2006 Sorry -- just a typo on my part.Ken Link to comment Share on other sites More sharing options...
Recommended Posts