Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i am using MYSQL database and would like to know which of this is a good practice.

way 1 - use column type in DB as timestamp. i.e will contain values like 2012-11-13 00:00:00 way 2 - use column as Date. i.e will contain values like 2012-11-13 in the database.

The question here is, to Store DOB. do we really need timestamp as the column type ? also the time section (00:00:00) is not required for a DOB in my opinion.

Please let me know the correct way to store DOB in database.

share|improve this question

closed as primarily opinion-based by Mark Storey-Smith, RolandoMySQLDBA, Max Vernon, bluefeet, Mike Walsh Dec 3 '13 at 21:51

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 1 down vote accepted

You should just use Date as datatype to store Date field.

Additionally, Specify Timestamp over Datetime datatype if records are often updated every time the record is changed. If you want to store a specific value you should use a Datetime as datatype.

share|improve this answer
Correct answer, for the wrong reasons... that's an oversimplification of the appropriate application of timestamp vs datetime, since timestamp is completely appropriate for static values if they will be in-range and you want the native time zone support to convert them. In this specific case, the fact that timestamp can only hold values between 1970 and 2038 (unlikely to be suitable for DOB) and stores/displays values converted to/from the session time zone and UTC (leading to the wrong date being returned if the time zone changes) would be the relevant pieces of info. – Michael - sqlbot Dec 1 '13 at 23:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.