We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Timestamp in EE

Development and Programming

Wired's avatar
Wired
181 posts
16 years ago
Wired's avatar Wired

I was wondering why ee stores their dates in a char format, instead of a datetime, or timestamp in MySQL. Is it better? I know it’s converted into a timestamp format, but the column type is not set as that, or am I mistaking in regards to this? I would have thought that setting and using that column type in the DB would have made things better, can I get some info in regards to this?

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

EE uses a number of date formats, internally, among them UNIX timestamps, or a YYYMMDDhhmmss representation. All this should matter little to the average user, since EE formats its date variables before output.

       
Wired's avatar
Wired
181 posts
16 years ago
Wired's avatar Wired

Yah, I am referring to this in a developer standpoint, why not stick to one format?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

Wired, there are a variety of performance and usage reasons for why this was done. At this point, your best option is to work with the formatting as it is while you build. =)

       
Wired's avatar
Wired
181 posts
16 years ago
Wired's avatar Wired

I am developing a few modules, I am going to be storing the date as a timestamp. In a previous post I asked this question, however I didn’t get the response I was looking for.

Anyway i would like to know what would be the benefits of storing this timestamp as a real timestamp in the db, as opposed to “char” type, would I have more or less control? Why is entry_date in the exp_weblog_titles field a char, does this offer more control?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

Hi, Wired,

I did not realize that you were asking this as guidance for building your own module. I have merged your posts and am moving these down to the Modules Technical Support forum.

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

There are mainly legacy reasons, not wanting to change existing behaviors that some users or third party software might rely upon. All newly created date fields use Unix timestamps, because it greatly simplifies things and takes much less work to localize.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.