Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Tuesday, June 24, 2014

Date Format Pattern In Android

How to get current format of the locale so that i can Format datetime with the format i get.
Means if i got the format then i can format that.
DateTime.Now.ToString(format);
This i am doing in visual studio with xamarin for creating Android application from C#.net.

-----------------------------------------
http://developer.android.com/reference/java/text/DateFormat.html
http://developer.android.com/reference/java/text/SimpleDateFormat.html
After two days of work , research and search
i am done with the issue by below code
Java.Text.DateFormat dateFormat = DateFormat.GetDateFormat(CurrentContext);
DateFormatPattern1 = ((Java.Text.SimpleDateFormat)dateFormat).ToPattern(); 
DateFormatPattern2 = ((Java.Text.SimpleDateFormat)dateFormat).ToLocalizedPattern(); 
from @MarkMelling post in http://stackoverflow.com/questions/9235934/get-preferred-date-format-string-of-android-system.