I am trying to get DateTimePicker
value in dd/MM/yyyy hh:mm:ss tt
format.DateTimePicker
code is
<xctk:DateTimePicker x:Name="startDateTimePicker" Value="{Binding SelectedDate}"
FormatString="dd/MM/yyyy hh:mm:ss tt" Width="280" Height="30" Watermark="Select DateTime"/>
I have mentioned the Format string as I want but it's giving me output as MM/dd/yyyy hh:mm:ss tt
. Not getting why this is happening. My system date time is MM/dd/yyyy
will that affect the result. If yes, how can I nullify that.
You should set the Format
property to Custom
for the FormatString
to be applied.
Try this:
<xctk:DateTimePicker x:Name="startDateTimePicker" Value="{Binding SelectedDate}"
Format="Custom"
FormatString="dd\/MM\/yyyy hh:mm:ss tt" Width="280" Height="30" Watermark="Select DateTime"/>