Jump to content

Archived

This topic is now archived and is closed to further replies.

Kris

Changing the format of a time field?

Recommended Posts

As default, the MySQL time datatype is formatted like this: HH:MM:SS, I'm trying to default it to just HH:MM - I have tried setting the fields character length to 5, and I have tried setting the default attribute to 00:00. Neither of these two attempts appear to have worked. Is this possible, or am I looking at altering the times with PHP after I have pulled it from the database?

Share this post


Link to post
Share on other sites
Use MySQL's TIME_FORMAT function -- TIME_FORMAT(yourField, '%H:%i').

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.