5 thoughts on “mysql date column type

  1. 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!

    1. 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

  2. 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. 😀

  3. 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:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s