Jump to content

jumping dates 30 days


Ninjakreborn

Recommended Posts

I am recieving a date, formatted like mm-dd-yy
so today would be like
9-18-06
How do I take that, and add 30 days to it, no matter what(also accounting leap year, and some months have less days than others.  Normally I just jump the month up one, but that won't work this time, it has to be 100% accurate, any advice.  I just need to hmm.
Well I need to come up with a date in the future, so when  button is pressed it checks all the things in the database, and checks there date.  Any that are after the current date get deleted.  So if someone was posting ads 2-3 months ago, and the ads are there, and the admin clicks the button, any ones that were dated have already passed.  Like if it expired yesterday, or 2 days ago, or a week ago, then all the ones that are expired then get deleted automatically.
so basically how do I add days to a date, take a formatted date, add a certain number of days to it, and get the date that it'll expire.

Like if I post it today, I need to add 30 days to the date, I need to take todays date, add 30 days to it, and return the new date, so I can have that date as the expiration date.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.