Jump to content

getdate() - something is wrong!


daydreamer

Recommended Posts

I am using the getdate() function for the time in one of myscripts.

 

It keeps giving me different hours!

 

one hour itll be 23.22, one hour later its 23.22.

 

The minutes will be accurate, just the hours will always be off and seem to be right sometimes, and another time itll be an hour out.

 

I have changed the line in my php.ini file to this:

date.timezone =GB 

 

Anyone know why my time isnt always accurate?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/125544-getdate-something-is-wrong/
Share on other sites

<?php
$now = getdate(); 

print_r($saved);
echo "<br>";
print_r($now);
echo "<br>";
echo "saved hour:".$saved["hour"]."<br>";
echo "saved minute:".$saved["minute"]."<br>";
echo "now hour:".$now["hours"]."<br>";
echo "now minute:".$now["minutes"]."<br>";
?>

 

$saved comes from a mysql record.

 

I just tried

$today = date("H:i:s");  

 

but its exactly the same time.

 

I am using getdate() because it automatically puts it into an array for easy processing, which i need to do for calculations, because i need to run a certain function after 10mins has passed from the last saved date in the mysql db.

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.