phpBB's storage of time and dates in the database

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
hasten
Registered User
Posts: 63
Joined: Mon Mar 31, 2003 7:49 am

phpBB's storage of time and dates in the database

Post by hasten »

Post, edit and other times are stored in the database as a int(11) column time (for UNIX timestamp). I would like to ask why the developers chose to do that. Is it faster than yyyy-mm-dd hh:mm:ss?

Database compatibility? Although -- the ANSI SQL standard supports the TIMESTAMP column type, and all the targetted databases phpBB supports can (I believe) accomodate the type.
Roberdin
Registered User
Posts: 1546
Joined: Wed Apr 09, 2003 8:44 pm
Location: London, United Kingdom

Re: phpBB's storage of time and dates in the database

Post by Roberdin »

I believe it's for easy conversion into different formats and timezones?
Rob
hasten
Registered User
Posts: 63
Joined: Mon Mar 31, 2003 7:49 am

Re: phpBB's storage of time and dates in the database

Post by hasten »

Roberdin wrote: I believe it's for easy conversion into different formats and timezones?
It couldn't be that difficult, could it? It's just a combination of strtotime() and date(), isn't it?
Roberdin
Registered User
Posts: 1546
Joined: Wed Apr 09, 2003 8:44 pm
Location: London, United Kingdom

Re: phpBB's storage of time and dates in the database

Post by Roberdin »

Well why bother to change it? Soemthing wrong with time()?

yyyy-mm-dd is used for birthdays, AFAIK.
Rob
hasten
Registered User
Posts: 63
Joined: Mon Mar 31, 2003 7:49 am

Re: phpBB's storage of time and dates in the database

Post by hasten »

Roberdin wrote: Well why bother to change it? Soemthing wrong with time()?

yyyy-mm-dd is used for birthdays, AFAIK.
The SQL column type "TIMESTAMP" is yyyy-mm-dd hh:mm:ss
q3utom
Registered User
Posts: 172
Joined: Sun Aug 10, 2003 8:53 pm
Location: folkestone, kent, uk
Contact:

Re: phpBB's storage of time and dates in the database

Post by q3utom »

I believe unix time format is more flexible and faster.
Roberdin
Registered User
Posts: 1546
Joined: Wed Apr 09, 2003 8:44 pm
Location: London, United Kingdom

Re: phpBB's storage of time and dates in the database

Post by Roberdin »

hasten wrote: The SQL column type "TIMESTAMP" is yyyy-mm-dd hh:mm:ss
I'm aware of that, merely pre-empting questions regarding how phpBB can store dates that occured before the Unix Epoch.
Rob
User avatar
CLee
Registered User
Posts: 97
Joined: Fri Nov 23, 2001 2:42 pm

Re: phpBB's storage of time and dates in the database

Post by CLee »

It is much easier and faster to use the time() function, which gives the same results based in the Unix Epoch regardless of the time zone you are in, and convert the results to whatever format you need using the built in PHP functions.
Carlos Myers
Member - Star Wars Roleplaying Club
hasten
Registered User
Posts: 63
Joined: Mon Mar 31, 2003 7:49 am

Re: phpBB's storage of time and dates in the database

Post by hasten »

q3utom wrote: I believe unix time format is more flexible and faster.
CLee wrote: It is much easier and faster to use the time() function, which gives the same results based in the Unix Epoch regardless of the time zone you are in, and convert the results to whatever format you need using the built in PHP functions.
If time calculations of UNIX epoch values are faster, then I see why the developers chose to use it.

I only asked about this because of the 2038 bug, but in retrospect we have 33 years before that becomes a problem. :lol:

I guess by then, 32-bit computers will be a thing of the past, vendors will upgrade their systems and we won't be running phpBB 3.0... maybe phpBB 25.0.
APTX
Registered User
Posts: 680
Joined: Thu Apr 24, 2003 12:07 pm

Re: phpBB's storage of time and dates in the database

Post by APTX »

Wouldn't it be common sense to a) count timestamps for 12 digit numbers or b) rest the time to 2038 (from 1970)? I'll be 50 by the time that bug beocomes reality...
Don't give me my freedom out of pity!
Post Reply