Kokombads
Kokombads

Reputation: 460

WPF Textbox Time format (not hundred hours)

I got here

    <TextBox IsReadOnly="True" x:Name="SessionTimeColumnTextBox 
        Binding="{Binding TreatmentTime, StringFormat=HH:mm}" 
        Visibility="Visible"
    />

but it shows hundred hours such as 17:32 instead of 5:32PM, how can I reformat the time into not hundred hours?

Upvotes: 0

Views: 6437

Answers (1)

Sriram Sakthivel
Sriram Sakthivel

Reputation: 73502

You're using the wrong format. HH means 24 hours format. Use hh for 12 hours format and tt for AM/PM designator.

StringFormat=hh:mmtt

Refer Custom Date and Time Format Strings

Upvotes: 3

Related Questions