Jump to content

Store Date as INT or as DATETIME in Mysql?


cunoodle2

Recommended Posts

I'm just curious as to which would use less resources/cpu processing?  In the past I've always just used the unix epoch integer and then used date() in php to format the output.

 

I'm working on a high volume website and looking to trim all resources as slim as possible for fast processing and am just curious.

 

In either case I need to do some form of processing to either convert the epoch using to date() to the proper output or convert the way that MySQL stores the data ("‘YYYY-MM-DD HH:MM:SS’ ") to the proper output to the screen.

 

Any input/discussion would be much appreciated.

Link to comment
Share on other sites

Storing the data is a timestamp will allow you to process it using mysql's date / tile functions. You can also do all your formatting in your queries.

Not sure why you chose TIMESTAMP instead of DATETIME... TIMESTAMP has all sorts of buggy unexpected "features".

 

Which is faster and using less resources?  Converting from the epoch INT to date() or converting the output in the mysql query?

 

Mods:  Does anyone know what phpfreaks does for timestamp processing???

Huh? Why are you converting?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.