Prashant Sharma
Prashant Sharma

Reputation: 91

change format of label from yyyy-mm-dd to dd-mm-yyyy in xamrin forms

I am trying to convert the format of a date in xaml by below code but it reponse nothing. I am sharing my xaml code. Thanks in advance.

 <Label HorizontalOptions="FillAndExpand" VerticalOptions="Center" 
                                                   FontAttributes="Bold" FontSize="14" Grid.Row="0" 
                                                   Grid.Column="1" 
                                                   Text="{Binding SaleDate, StringFormat='{0:MMMM d, yyyy}'}"                                                      
                                                   Padding="-15,0,0,0"></Label>

enter image description here

Upvotes: 0

Views: 543

Answers (1)

Harsh Shah
Harsh Shah

Reputation: 188

Your string format is wrong. Use this string format. this will convert DateTime to dd-mm-yyyy format

StringFormat='{00:dd-MM-yyyy}'

don't create converter if you can get solution on XAML itself

Upvotes: 1

Related Questions