Current system time on PHP Webpage

Discussion in 'General' started by Pashy, Jun 4, 2010.

  1. Pashy

    Pashy New Member

    Hi Folks,
    I want to display the current system (linux) time
    in the webpage using PHP code
    I have tried numerous codes had a mismatched time as output.
    Finally I have tried the code :
    <?php

    $date = date('l dS \of F Y h:i:s A');

    echo "$date";

    ?>

    Output:
    Friday 04th of June 2010 07:58:53 AM

    where as the actual system time is :
    Friday 04th of June 2010 08:58:53 PM

    The system local time is Japan/Tokyo.
    Can anyone help me with the resolution to this issue
    on priority.
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Does this still happen after a reboot?
     
  3. Rapid2214

    Rapid2214 New Member

    Looks like a daylight saving error, look in you php.ini :D
     
  4. mgolra

    mgolra New Member

    @ Pashy & Falko
    Hi!
    try this code. it is working

    <?php
    $time_now=mktime(date('h')+3,date('i'),date('s'));

    print "<br>".date('h:i:s',$time_now);
    ?>
     
  5. todx

    todx New Member

    I believe this issue has been resolved in 2 years.. no need to revoke old post xD
     

Share This Page