mysql date column type

i have to say that the decision to make the birthday column for members on the new board type DATE is a very good one. i never knew about all the magic mysql DATE type can do :)

but i still love the simplicity of time arithmetic unix timestamp provides.


5 Comments Leave a Comment

Bubs [ Quote ]

Wow, thanks for the link! I’ve been working with PHP and built-in dates in mySQL and I kept running into problems :ouch: I can’t wait to give this a try!

April 11th, 2005 at 4:25 pm
Daynah [ Quote ]

heehee.. I tried to tell you! :) I’ve use mysql date too much.. I don’t even know how to revert back to unix timestamp.

April 11th, 2005 at 6:21 pm
dodo [ Quote ]

actually you can do something like select UNIX_TIMESTAMP(date_column) and it returns the unix timestamp. tho i still don’t see a very convenient way with date type to figure something like how many days it’s from a certain date. in unixstamp, you can just do
($timerightnow - $dateinquestion) / 24 * 3600 = NUM OF DAYS

April 12th, 2005 at 8:33 am
Cine [ Quote ]

What I don’t like about having unix timestamps in the database is that it is impossible to read for the human eye. Which means, that when browsing the database with phpMyAdmin it’s really difficult to actually look at the dates. That’s why I more often than not set the type as DATE. :D

May 27th, 2005 at 10:40 am
Fallen [ Quote ]

I have started using mysql based dates, times, timestamps instead of doing work with PHP, and my work has became much easier. If you trying to decide if place unix timestamp in the database or mysql native, GO for mysql one, your life will be easier too :biggrin:

December 13th, 2007 at 9:11 am

Leave a Comment Name, email and comment are required.
Email will never be displayed.

Leave a Comment
  1. :biggrin: :blank: :blush: :bored: :confused: :cool: :down: :evil: :frown: :grin: :grr: :laidback: :left: :mad: :right: :sad: :secret: :shock: :smile: :stress: :tongue: :up: :wink: :yawn: :cute: :dead: :film: :floppy: :glasses: :grumpy: :headphones: :heart: :lightbulb: :ouch: :tv: :upsidedown: :vodka: :yell: :yuck: :yummy: