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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Location
    Spokane, WA
    Posts
    148
    Thanks
    4
    Thanked 4 Times in 4 Posts

    Adding 90 days, and comparing dates

    I am writing a small script and I have two simular date related questions.

    1) I have stored in a DB a date such as 12/13/2008, but the date stored could be any previous date, not just todays date, what I need to do is add 90 days to the date and echo that to the user

    2) I would like to compare today's date with the value generated in question 1 to determain if today is the date generated or before, or after, then depending on that set a boolean that I would use to either show an message to the user or not.

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    MySQL provides a number of Date and Time functions that will do what you want.

    For example, for #1, you can look into DATE_ADD()

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    1) I have stored in a DB a date such as 12/13/2008, but the date stored could be any previous date, not just todays date, what I need to do is add 90 days to the date and echo that to the user
    Take some effort to change them to the datetime format. All your other operations will be simplified then!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Tags for this Thread

    Posting Permissions

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