Pure-Essence.Net

mysql date column type

Posted by: pureessence on: April 11, 2005

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.

Advertisement

5 Responses to "mysql date column type"

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

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.

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

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

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:

Gravatar
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

My most adorable Pomeranians

Categories

Archives

SocialVibe


Follow

Get every new post delivered to your Inbox.