time not updating

Posted on 2004-11-18
Last Modified: 2006-11-17
$date = date("Y-m-d h:m:s");

the date is correct but the time is not updating.  $date could be, 2004-11-18 02:11:00 and 5 min later, running the script again, it will still be 2004-11-18 02:11:00

Any Ideas?
Question by:gmailrules
    LVL 27

    Expert Comment

    Nothing wrong with that code:

     $date = date("Y-m-d h:m:s");
     echo $date;

    Is it possible that you are referencing a static string or database field accidently, eg. if you have a date stored in a string assigned to a variable.

    Or perhaps your server clock has mysteriously frozen :)

    If you could post a little more code if in doubt...
    LVL 1

    Author Comment

    found out the problem :D

     $date = date("Y-m-d h:m:s"); should be  $date = date("Y-m-d h:i:s");
    LVL 27

    Expert Comment

    good spot :)

    Ran the code on my box saw the seconds updating and overlooked the minutes.

    Best Wishes

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now