Jump to content

Strange problem with time()


tastech

Recommended Posts

I'm trying to get a form working that automatically inserts the current time into field when it's opened i.e. adding record.  However I'm having a strange thing happen that I can't work out.

 

Basically if I use the time() function I get (95% of the time) 7 minutes past the hour.

 

So at 14:00 it returns 14:07 and keeps returning 14:07 throughout the hour until 15:00 then it returns 15:07.  I can close the form, close the browser but it still has this problem.

 

I've created a plain page with the following

 

<?php

$showtime = 0;

$showtime = date("H:m", time());

echo $showtime;

?>

 

Every time I refresh this page the time behaves as described above. As I type this I refresh it again. My MS computer shows 14:53 and my unix server shows 14:53 but this function returns 14:07.

 

I don't believe that it's a PC thing or browser thing as I've tried several different PC/Laptops and browsers.

 

:confused:

Link to comment
https://forums.phpfreaks.com/topic/241616-strange-problem-with-time/
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.