Home > database >  convert dateTime into Time using Only Time while binnding
convert dateTime into Time using Only Time while binnding

Time:05-01

I have a binding value, which is DateTime DataType and I'm trying to convert it into Time only, it's in this context Text="{Binding AppointmentDate.Value.ToString("H:mm") }" in the label but this is not working and gives errors, How can I convert it and use only time without touch c# file?

CodePudding user response:

Change time format this way .

<Label Text="{Binding AppointmentDate, StringFormat='{0:MMMM dd, yyyy}'}"></Label>
<Label Text="{Binding AppointmentDate, StringFormat='{}{0:hh\\:mm}'}"></Label>
  • Related