1
kerkyra
working with dates
  • 2008/2/24 3:06

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


Hi i'm trying to make a function to set an expire date for an article. What i want to do is look at the db and take an integer. 30 for example (this will be the number of days that this article will be online since the date it was created).

how can i add this value to the date submitted in order to make the expiration date and store it in the db?

i store the submission date in the db calling the function time().

Is there a way to add a number of days to this function and get the future expiration date? thanks.
www.guidemap.gr - Beta is out...

2
kerkyra
Re: working with dates
  • 2008/2/24 13:52

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


anyone?
www.guidemap.gr - Beta is out...

3
ChaoticMess
Re: working with dates

Just look at the date function. there are a number of ways to do this and examples on the date function page at php net. I do lots of timing work and usually work with clock ticks. You can store the date of submission in the db and when its 30 days worth of clock tics (30 days * 3600 seconds per hour * 24 hours per day) past your time() value expire the article.

4
kerkyra
Re: working with dates
  • 2008/2/28 9:06

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


thanks mate, i had a look at the date function and managed to do what i wanted, the way you just described. Everything works well now. :)
www.guidemap.gr - Beta is out...

5
irmtfan
Re: working with dates
  • 2008/2/28 15:18

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


also looking to the other modules that already have this feature can help you. eg: news by Herve

Login

Who's Online

73 user(s) are online (43 user(s) are browsing Support Forums)


Members: 0


Guests: 73


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits