Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to format date and time in XAML in Xamarin application

I have a set up XAML code below.

<Label Text="{Binding Date}"></Label> <Label Text="{Binding Time}'}"></Label> 

I want result like september 12,2014 2:30 PM.

like image 875
Narendra Avatar asked Sep 28 '15 00:09

Narendra


People also ask

What is the role of XAML in xamarin?

XAML allows developers to define user interfaces in Xamarin. Forms applications using markup rather than code. XAML is never required in a Xamarin. Forms program, but it is often more succinct and more visually coherent than equivalent code, and potentially toolable.


1 Answers

Change your code to:

<Label Text="{Binding Date, StringFormat='{0:MMMM dd, yyyy}'}"></Label> <Label Text="{Binding Time, StringFormat='{}{0:hh\\:mm}'}"></Label> 
like image 105
User1 Avatar answered Sep 20 '22 09:09

User1