Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.