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 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    time functions in php

    hi,

    i'am new one to php.i have one doubt in time functions.my requirement is, i have to add 10mins with the current time.i dont have idea about this.can anyone help me.

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    the strtotime function is quite intelligent in parsing relative times:
    PHP Code:
    echo strtotime('+10 minutes'); //will give the timestamp
    echo date('Y-m-d H:i:s',strtotime('+10 minutes')); //will give a more readable format 
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi,

    i tried your code,it works :-)

    but your code display the current time in Unix timestamp format.how i convert that unix timestamp into my local time?

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    The second line of the posted code above shows you.

  • #5
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Wouldn't this be much more consistent/obvious/efficient?

    PHP Code:
    $timePlusTenMinutes time() + 60 10;
    echo 
    date('r'$timePlusTenMinutes); 

  • #6
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts
    I think both are good

  • #7
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi aedrin,

    i tried ur code.its really good.thanks:-)

  • #8
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi,

    i have one doubt.is it possible to display the clock in my site using php not javascript?if possible,then tell me the solution.

  • #9
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    how to convert GMT(Greenwich Mean Time) to IST(Indian Standard Time) format?


  •  

    Posting Permissions

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