Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    417
    Thanks
    168
    Thanked 1 Time in 1 Post

    Question Getting current date/time and then adding to it

    Hi,

    I am trying to get the current date/time in PHP in this format: 20070320091012

    and then I am trying to add $minutes and $seconds to it
    something like:
    Code:
    $timeNow = getdate();? -- I know this is wrong, how to do it?
    $timeLater = $timeNow + $minutes + seconds;
    where $minutes can equal 2, 3 or 4 for instance and $seconds can equal 15, 30 or 45 for instance

    how would I do this in PHP? thanks

  • #2
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    PHP Code:
    $current date('YmdHis');
    $later date('YmdHis'time() + (60));

    echo 
    'the current time is ' $current '<br>in 5 minutes it will be ' $later


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •