Bug in printing time in php.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ameed Jamous
    New Member
    • Sep 2010
    • 1

    #1

    Bug in printing time in php.

    Hello,

    Am using the below code to view server localtime on my website , but the interesting issue is that its always showing extra one hour from server time e.g.

    Code:
    <?php 
    
    /** 
    // Displays in the format Saturday, November 22, 2003 11.38 
    echo date("l, F d, Y h:i" ,time()); 
    
    ?>
    the win server time is 10:00 pm when i excute this php code it shows the time 11:00 pm .

    Am using Xampp V.1.7.0.

    Can you please help ?
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Heya Ameed Jamous, Welcome to Bytes!


    Make sure your timezone is correct.

    php.net/date_default_ti mezone_get

    see related functions as well.

    It could also be the difference between Daylight Savings and Standard time.

    Good luck,


    Dan

    Comment

    Working...