Linux Today: Linux News On Internet Time.

Converting between MySQL Date and Time Formats

Mar 11, 2011, 15:32 (0 Talkback[s])
(Other stories by Rob Gravelle)

"All of the larger systems that I've helped develop necessitated storing some combination of date and time fields. Almost universally, these fields presented difficulties of some kind or another. One particularly memorable challenge was converting between internal storage and display formats that featured the month name rather than a numeric one. We were able to overcome it using a combination of database and programming solutions, but it would have been much easier had we been using MySQL. Its thorough and flexible date handling allows you to switch between internal and external date/time formats with relative ease. Now I'd like to show you what we could have done in MySQL...

"Some Date/Time Basics

"MySQL supports a variety of date/time data type combinations. All you have to do, when creating a date/time column, is choose one of the following types that most closely matches the date/time portion and accuracy that you require:"

Complete Story

Related Stories: