Bug 3539 - DateTime short time format ("g") is incorrect for Australian locale
Summary: DateTime short time format ("g") is incorrect for Australian locale
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: master
Hardware: Other Other
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on: 4782
  Show dependency tree
Reported: 2012-02-19 19:13 UTC by Paul Donovan
Modified: 2012-05-15 13:40 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Paul Donovan 2012-02-19 19:13:29 UTC
The output of converting a DateTime object to a string using the "g" formatter is incorrect when using the Australian locale on the iPhone. The 'M' at the end of PM is missing.

Using MonoTouch 5.2.4 and the iOS 5.0 SDK, targeting iOS 4.3 on the iPhone simulator, if you go to Settings->General->International->Region Format and choose Australia, the   output of the DateTime to string is incorrect when running the following code:

DateTime dt = new DateTime(2012, 12, 30, 23, 30, 15);
Console.WriteLine(String.Format ("Time is {0:g}", dt));

Expected results:

Time is 30/12/2012 11:30 PM

Actual results:

Time is 30/12/2012 11:30 P

This doesn't appear to be something as simple as a string buffer being the wrong length, as when the locale is US it's able to output a string that's as long as the required Australian output:

Time is 12/30/2012 11:30 PM
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-02-21 19:26:43 UTC
This can also be reproduced with a simple console application:

using System;
using System.Diagnostics;
using System.Threading;
using System.Globalization;

class gdb {
  static void Main(string[] args) {
    var ci = new CultureInfo ("en-AU");
    Thread.CurrentThread.CurrentCulture = ci;
    Thread.CurrentThread.CurrentUICulture = ci;
    Console.WriteLine (ci.DisplayName);
    Console.WriteLine (string.Format ("Time is {0:g}", new DateTime(2012, 12, 30, 23, 30, 15)));
Comment 2 Marek Safar 2012-05-15 13:40:32 UTC
Fixed in master