Formatting a time field from mysql

QuestionsFormatting a time field from mysql
Michael Olson asked 1 year ago

I would like to format a time field that is stored in MySQL table to display such as 2:35 pm instead of 14:35:00

I cannot get any of the datetime examples to work.

3 Answers
Cedric answered 1 year ago

Hello, you should be able to use the mysql command to format it the way you want.

What type is the mysql field? Datetime? if yes you should be able to use somethins like this:

SELECT *, DATE_FORMAT(urdatefield, "%d/%m/%Y %r") FROM yourtable;
Michael Olson answered 1 year ago

It is a time field. Not datetime. But when editing the time I want the user to be able to enter it as am or pm.

Michael Olson answered 1 year ago

Any more help on this one? I know that when I pull the data from the server I can display it by formatting it in the select. What I am asking about is when using the grid add or edit function how I can allow the user to put in a time such as “2:02 pm” instead of 14:02

Your Answer

4 + 9 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?