How can i add one second to time?

Discussion in 'PHP' started by baris22, Feb 15, 2009.

  1. #1
    hello,

    
    $datetime=date("Y-m-d H:i:s");
    
    PHP:
    I want to add one second to $datetime

    How can i do this?

    Thanks
     
    baris22, Feb 15, 2009 IP
  2. DealFinder

    DealFinder Active Member

    Messages:
    120
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    68
    #2
    DealFinder, Feb 15, 2009 IP
  3. Scripten

    Scripten Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You should try the following code:

    
    <?php
    $time_sec1 = date("s");
    $time_sec2 = $imte_sec1 + 1;
    $datetime=date("Y-m-d H:i:" . $time_sec2 . "");
    ?>
    
    PHP:
    It should work without any problem.
     
    Scripten, Feb 15, 2009 IP
  4. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Thank you. it worked perfect.
     
    baris22, Feb 15, 2009 IP