Format DateTime in Xamarin Forms to Device Format string
<p>How can I format a <code>DateTime</code>object to a string in the device default datetime format when running a PCL Xamarin.Forms project and my deployement targets include iOS, Android and Windows. </p>

<p>The <code>DateTime.ToShortString()</code> doesn't work as per MSDN requirement according to this <a href="https://forums.xamarin.com/discussion/1289/date-format-issue-bug-1068-need-workaround" rel="noreferrer">thread</a> and this <a href="https://bugzilla.xamarin.com/show_bug.cgi?id=1068" rel="noreferrer">bug</a>. </p>

<p>Is there any Forms based solution or do I need to get it from platform specific projects?</p>

<p>For Android, I can do the following from Native project using DI: </p>

<pre><code>String format = Settings.System.GetString(this.context.ContentResolver 
                                         , Settings.System.DateFormat);
string shortDateString = dateTime.ToString(format);
</code></pre>

<p>OR I can use this too (the C# version of the below code): </p>

<pre><code>DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(context);
</code></pre>

<p>Look into <a href="https://stackoverflow.com/questions/6981505/how-to-get-user-selected-date-format-in-android">this</a> SO question to understand the requirement more clearly (its only for android, I want it for all platforms as this is a Xamarin.Forms question). </p>

<p>Since the <code>DatePicker</code> and <code>TimePicker</code> in Xamarin Forms show the date and time in device format I am hoping there would a way to get it in the PCL. </p>

<p>Also there is a <code>Device</code> class in PCL which has information like platforms, idiom, etc. </p>