Menu

Format time as 12 hour

0 votes

I'm trying to set a datetime2(0) column to show the time in 12 hour format. Per this KB article, I entered g as the format string. While the column does change in the grid view, it just switches from MM/dd/yyyy hh:mm:ss to yyyy-MM-dd hh:mm:ss.

With no format string:
https://i.imgur.com/s9ndf8O.png

With g as format string:
https://i.imgur.com/OADP0r6.png

Field Preferences:
https://i.imgur.com/3FPPjl4.png =300x

Tested in SSMS:
https://i.imgur.com/nvuAoaG.png =500x

As a separate but related feature request: Please add an option to apply a field's formatting on the form view as well. I understand the rationale to have the default be no formatting, because it may hide information or make it difficult to edit. But it would be nice if administrators had the option to override that setting.

in How To by (510 points)
I will consider adding the 24 vs AM/PM option to the database settings.

1 Answer

0 votes

The standard date formatting specifiers can return a 24 hour time depending upon the regional settings.

For more details see: Microsoft Standard Date/Time Formatting Strings.

To force the use of AM/PM you can use the custom formatting string "yyyy-MM-dd hh:mm:ss tt". For more details see: Custom Formatting Strings

by (44.5k points)
By regional settings do you mean the language? It's set to us_english.
"yyyy-MM-dd hh:mm:ss tt" has the same effect for me, still shows 24 hour time.
You are correct.  The format string only applies to reports now because the next release of dbFront will include grid editing.  That adds more urgency to your request for a optional 24/12 hour support in editable fields.
Ok understood, thanks Anthony.
Welcome to the dbFront Q&A site, where you can ask questions and receive answers from other members of the community.
 | Minimalist Answer Theme by Digitizor Media
 |
Powered by Question2Answer
...