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
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts

    how do I add on one year? to date??

    Hello everyone


    how do I add on one year???

    this gives me my date but I need to add 1 year
    '".date("Y-m-d H:i:s", strtotime(mysql_real_escape_string($exp_date)))."',


    I tried this --- but it failed (i'm trying to set a future expiry date)
    '".date("Y-m-d H:i:s", strtotime(mysql_real_escape_string($exp_date "+1 year")))."',


    ALSO i'm unsure about this

    on MySQL INSERT I use now() to add another date field

    do I need to use mysql_real_escape_string around now()


    thanks

    LT
    Last edited by low tech; 12-02-2010 at 10:49 AM.

  • #2
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    What does $exp_date look like before its ran through the date function

  • #3
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts
    Hi seco

    Expiry date is expected like this

    00:31:02 Nov 03 2010 PDT


    ALSO i'm unsure about this

    on MySQL INSERT I use now() to add another date field

    do I need to use mysql_real_escape_string around now()


    Thanks

    ps If I can't add one year to my set up as i have it now, I guess I could rearrange and not use teh date var that I am getting

    LT

  • #4
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    PHP Code:
    <?php
    $date 
    date("Y-m-d H:i:s"time() + 60 60 24 365); // now + one year
    ?>

  • Users who have thanked poyzn for this post:

    low tech (12-02-2010)

  • #5
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts
    Thanks poyzn

    any idea on

    ALSO i'm unsure about this

    on MySQL INSERT I use now() to add another date field

    do I need to use mysql_real_escape_string around now()

    I'm not using at the moment but wonder if I should / need to??

    LT

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by poyzn View Post
    PHP Code:
    <?php
    $date 
    date("Y-m-d H:i:s"time() + 60 60 24 365); // now + one year
    ?>
    PHP Code:
    echo date("Y-m-d H:i:s"strtotime("Now + 1 year")); 
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    low tech (12-02-2010)

  • #7
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts
    Thanks all

    yeh I have this bit now:-)

    one small step and all that eh what:-)

    LT

  • #8
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    Quote Originally Posted by low tech View Post
    Thanks poyzn

    any idea on

    ALSO i'm unsure about this

    on MySQL INSERT I use now() to add another date field

    do I need to use mysql_real_escape_string around now()

    I'm not using at the moment but wonder if I should / need to??

    LT
    No, you don't need to use mysql_real_escape_string around now()

  • #9
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts
    Thanks

    I was still wondering hahahhahaa

    assumed my question was dumb hahhahaha

    LT


  •  

    Posting Permissions

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