Jump to content

start and end of day


Jocka

Recommended Posts

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=1165471200
pm=1165514399

December 8th:
am=1165557600
pm=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

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

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.