Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 23544 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
From the fourm: http://forums.xamarin.com/discussion/24987/cultureinfo-currentculture-datetimeformat-android-format
The format returned by CultureInfo.CurrentCulture.DateTimeFormat is not the same as the format displayed in the rest of Android and also does not take account of the "Use 24-hour format" setting.
- With the language set to English (United Kingdom) the time is by default, 24 hour. If I uncheck "Use 24-hour format" Android shows a format without AM/PM. CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern still returns HH:mm:ss.
- With the language set to English (United States) the time by default is 24 hour so the opposite happens. Interestingly, CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern returns h:mm tt which does not match the format displayed in the rest of Android of h:mm.
I have checked this issue and unable to reproduce it.
I have tried following steps to reproduce it.
1.Create Xamarin android application.
2.Did Some code in MainActivity.cs
var timepattern = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.ToString ();
3.Set breakpoint on this line .
4.Run the application.
I observed that above code always returns HH:MM in both 24 hour and 12 hour time format.
Additonal Info :
Returns HH:MM format when change time zone.
Let me know If I missed anything to reproduce it.
Screencast regarding Same :
=== Xamarin Studio ===
Version 5.4 (build 240)
Installation UUID: b5156fb6-e8d3-47e2-b3a5-0925a4054ffd
Microsoft .NET 4.0.30319.34003
GTK+ 2.24.22 (MS-Windows theme)
=== Xamarin.Android ===
Version: 4.16.0 (Trial Edition)
Android SDK: D:\android-sdk
Supported Android versions:
1.6 (API level 4)
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.0 (API level 11)
3.1 (API level 12)
4.0 (API level 14)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
Java SDK: C:\Program Files\Java\jdk1.7.0_67
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
=== Build Information ===
Release ID: 504000240
Git revision: 01786bc67c7024ec33d327ed27e4416d7a846f4e
Build date: 2014-09-17 11:05:20-04
Xamarin addins: 7cd7dfcd6b7b7b53281508954ec080f1cd153ad3
=== Operating System ===
Windows 6.2.9200.0 (64-bit)
> I observed that above code always returns HH:MM in
> both 24 hour and 12 hour time format.
This is in fact your reproducing the issue. Rephrasing Comment #0:
> The format returned by CultureInfo.CurrentCulture.DateTimeFormat...
> does not take account of the "Use 24-hour format" setting.
meaning that the value *should* differ between 24-hour and 12-hour format, yet your observation is that the values are the *same* between both formats.
Comment #0 also mentioned using United Kingdom and United States locales, neither of which were reported as having the HH:MM format you provided in Comment #1.
That's correct Jon. The reason I mentioned the US and UK cultures is because they have different defaults (US is 12-hour, UK is 24-hour).
If the user is in the UK and unchecks "Use 24-hour format" in the device's settings, it will be ignored and .NET/mono will still return a 24-hour time format (HH:mm). If a user in the US checks "Use 24-hour format" .NET/mono will still return a 12-hour time format (h:mm).
This is not easily fixed.
The problem is that the CultureInfo.DateTimeFormat information comes from locale data "baked into" mono. It is not looked up from Java:
Fixing this will require:
1. Figuring out the appropriate Java APIs from which to extract the appropriate format information.
2. Update CultureInfo so that instead of calling into mono it calls into Mono.Android.dll (so that it can more easily perform the Java calls).
I have checked this issue and observed that XVS 3.3.47(XA 4.14) returns CultureInfo in HH:mm format and XVS 3.7.248 (XA 4.18) returns cultureInfo in h:mm tt format.
Below are my observation with diffrent XVS build and with diffrent timezone.
using var timepattern = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.ToString();
TimeZone 24 Hour Checked timepattern
GMT +0:00 Yes h:mm tt
GMT +0:00 No h:mm tt
GMT -11:00 No h:mm tt
GMT -11:00 Yes h:mm tt
GMT +00 Yes HH:mm
GMT +00 No HH:mm
GMT -11 No HH:mm
GMT -11 Yes HH:mm
GMT+ 5.30 yes HH:mm
Getting same behaviour with device.
Screencast : http://www.screencast.com/t/OOZfKbbDMDNV
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Installed Version: Professional
Xamarin.Visual Studio 18.104.22.168 (0b2a123923812a88ed3091909478dbe9e0111f00)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android
Xamarin.Visual Studio 22.214.171.124
java version "1.7.0_72"
Changing to NEW as the problem is understood, if somewhat intractable.