Jump to content

problem with dates


BODEKA

Recommended Posts

I am having poblem with dates.


When I run the following code how come I get
$today-$yesterday: 25 hours

and

$tomorrow-$today: 24 hours
--------------------------------
<?php

$now = time();

$today    = mktime(0, 0, 0, date("m", $now)  , date("d", $now),  date("Y", $now));
$yesterday = mktime(0, 0, 0, date("m", $now)  , date("d", $now)-1, date("Y", $now));
$tomorrow  = mktime(0, 0, 0, date("m", $now)  , date("d", $now)+1, date("Y", $now));


echo "today-yesterday: ".($today-$yesterday)/$hour." hours"."<br />";
echo "tomorrow-today: ".($tomorrow-$today)/$hour." hours"."<br />";

?>
Link to comment
https://forums.phpfreaks.com/topic/25646-problem-with-dates/
Share on other sites

Archived

This topic is now archived and is 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.