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:

With g as format string:

Field Preferences: =300x

Tested in SSMS: =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 (2.3k 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 (64.3k 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