PHP + MySQL + Dates (and using them, not just storing)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
FuzzyLogik
Forum Newbie
Posts: 18
Joined: Tue Dec 12, 2006 12:15 am

PHP + MySQL + Dates (and using them, not just storing)

Post by FuzzyLogik »

I have (...well, I WILL have) a script that will log a value to a database and keep it there for 14 days.

After 14 days, it will retrieve the value again, update the database, and update the timestamp.

Can someone please guide me along this process? I mostly need help on the best way to achieve this. I am using "MEDIUMINT" for the column, but that can be changed.


How should I store the timestamp (format?) and which function? I was just reading something about using datetime instead of timestamp or something... is one way better than the other? I don't need it to store the TIME, only the DAY (it will refresh every 14 days)

Any help will be appreciated.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Re: PHP + MySQL + Dates (and using them, not just storing)

Post by feyd »

FuzzyLogik wrote:How should I store the timestamp (format?)
Some native type that fits your needs. DATE, TIME, DATETIME, TIMESTAMP, etc...
FuzzyLogik wrote:which function?
Which function for what?
FuzzyLogik wrote:I was just reading something about using datetime instead of timestamp or something... is one way better than the other?
They behave a bit differently in different databases. You should read the documentation on each in your respective database's manual.
Post Reply