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.
phpBB's storage of time and dates in the database
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!
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!
-
- 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
I believe it's for easy conversion into different formats and timezones?
Rob
Re: phpBB's storage of time and dates in the database
It couldn't be that difficult, could it? It's just a combination of strtotime() and date(), isn't it?Roberdin wrote: I believe it's for easy conversion into different formats and timezones?
-
- 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
Well why bother to change it? Soemthing wrong with time()?
yyyy-mm-dd is used for birthdays, AFAIK.
yyyy-mm-dd is used for birthdays, AFAIK.
Rob
Re: phpBB's storage of time and dates in the database
The SQL column type "TIMESTAMP" is yyyy-mm-dd hh:mm:ssRoberdin wrote: Well why bother to change it? Soemthing wrong with time()?
yyyy-mm-dd is used for birthdays, AFAIK.
-
- 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
I believe unix time format is more flexible and faster.
-
- 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
I'm aware of that, merely pre-empting questions regarding how phpBB can store dates that occured before the Unix Epoch.hasten wrote: The SQL column type "TIMESTAMP" is yyyy-mm-dd hh:mm:ss
Rob
Re: phpBB's storage of time and dates in the database
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
Member - Star Wars Roleplaying Club
Re: phpBB's storage of time and dates in the database
q3utom wrote: I believe unix time format is more flexible and faster.
If time calculations of UNIX epoch values are faster, then I see why the developers chose to use it.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.
I only asked about this because of the 2038 bug, but in retrospect we have 33 years before that becomes a problem.
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.
Re: phpBB's storage of time and dates in the database
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!