开发者

date picker format wp7 showing time

开发者 https://www.devze.com 2023-04-03 06:38 出处:网络
I want to change my date picker format in windows phone 7. I have changed it to {0:dd-MM-yyyy} but I still get both date and time in the string and also the preceding zeroes are omitted.

I want to change my date picker format in windows phone 7. I have changed it to {0:dd-MM-yyyy} but I still get both date and time in the string and also the preceding zeroes are omitted. like if I want a date like 03-11-1988 all I get is 3/11/1988 00:00 AM.

how do I correct this ?

this is my xaml

<toolkit:DatePicker Margin="261,463,0,0" x:Name="datePicker1" HorizontalAlignment="Left" VerticalAlignment="Top" d:LayoutOverrides="VerticalAlignment" ValueStringFormat="{}{0:dd-MM-yyyy}" />
<toolkit:DatePicker Horiz开发者_运维知识库ontalAlignment="Left" Margin="261,558,0,0" x:Name="datePicker2" Height="77" VerticalAlignment="Top" ValueStringFormat="{}{0:dd-MM-yyyy}" />
<toolkit:DatePicker HorizontalAlignment="Left" Margin="261,648,0,0" x:Name="datePicker3" VerticalAlignment="Top" ValueStringFormat="{}{0:dd-MM-yyyy}" />


I am talking about the value property.

The display in the selector is correct.The value property is returning string in the form like 3/12/2011 00:00 AM. although

String txtDate = Convert.ToString(txtDated.ToShortDateString());    

removes 00:00AM but the date is still 3/12/2011 format and i want 03-12-2011 for which i think the only solution is replacing / with - in the string.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号