Bug 22212 - Error parsing DateTime string in New Zealand Culture.
Summary: Error parsing DateTime string in New Zealand Culture.
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.12.0
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-08-19 14:20 UTC by Amit Taparia
Modified: 2014-11-28 09:12 UTC (History)
4 users (show)

Tags:
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 Developer Community or GitHub 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:
Status:
VERIFIED FIXED

Description Amit Taparia 2014-08-19 14:20:43 UTC
We are getting error while parsing DateTime string's in NZ culture.

Please run the following piece of code in a Console App & on the device.

var info = new CultureInfo("en-nz");
DateTime d = new DateTime(2014, 08, 22, 12, 34, 22);
string v = d.ToString(info);
Console.WriteLine(v);

Result:

a) Onn the Console App = "22/08/2014 12:34:22 p.m."
b) On the Device: ""22/08/2014 12:34:22 PM""

We except that on the device you should be getting similar behavior that you are getting on the console app i.e. the AM/PM designator's should be a.m. and p.m. instead of AM and PM.
Comment 1 Rajneesh Kumar 2014-08-20 03:49:22 UTC
I have checked this issue and able to reproduce this. To reproduce this I run the given code in Console and Android Application.

var info = new CultureInfo("en-nz");
DateTime d = new DateTime(2014, 08, 22, 12, 34, 22);
string v = d.ToString(info);
Console.WriteLine(v);

In Console Application I observed that the output to the console is "22/08/2014 12:34:22 p.m.".
I also observed that when I run this code using android application and deploy to the emulator the output is "22/08/2014 12:34:22 pm". I also getting the same output on the physical android device.

Expected Result: The user except same output to the device as he is getting to the console. The am/pm designator's should be a.m. and p.m. insted of AM and PM.

Screencast: http://www.screencast.com/t/c5dhxh9fb

Environment Info:

=== Xamarin Studio ===

Version 5.2.1 (build 1)
Installation UUID: 3b924754-5196-440a-b42b-05ebb3a3082e
Runtime:
	Microsoft .NET 4.0.30319.18408
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 4.14.0 (Business Edition)
Android SDK: D:\Android\android-sdk
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		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)
Java SDK: C:\Program Files\Java\jdk1.6.0_31
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)

=== Build Information ===

Release ID: 502010001
Git revision: d06832ce9807d6be24aca225457e8b37c7669f6f
Build date: 2014-08-07 14:35:09-04
Xamarin addins: 1de032531be4cecf2f39dbee3b87aac78204058c

=== Operating System ===

Windows 6.1.7601.65536
Comment 2 Marek Safar 2014-09-22 11:31:00 UTC
Fixed in mono master
Comment 3 Shruti 2014-11-28 09:12:39 UTC
I have checked this issue and it  has been fixed. To check this issue, I have created an android application and implemented code given in comment(0).  Now, we are getting p.m. instead of pm.

Screencast regarding same : http://www.screencast.com/t/X4JVHjXFE

Environment Info :
=== Xamarin Studio ===

Version 5.7 (build 596)
Installation UUID: 67eaf3b4-f8a7-4ab4-a9df-3197350ca5dc
Runtime:
	Mono 3.12.0 ((detached/b75fa2b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000046

=== Apple Developer Tools ===

Xcode 6.2 (6736)
Build 6C86e

=== Xamarin.iOS ===

Version: 8.6.0.5 (Business Edition)
Hash: 880cc21
Branch: 
Build date: 2014-11-25 12:12:17-0500

=== Xamarin.Android ===

Version: 5.0.0.0 (Business Edition)
Android SDK: /Users/ixamarin78/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		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)
		5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin.Mac ===

Version: 1.10.0.18 (Business Edition)

=== Build Information ===

Release ID: 507000596
Git revision: d996e9ba6874a0d64241e43e5e6b06322ce29c84
Build date: 2014-11-25 17:17:54-05
Xamarin addins: 8ca19707b41536a391f53364ee4ff9272711feb0

=== Operating System ===

Mac OS X 10.10.0
Darwin XamnewiMac.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64

Hence, I am closing this issue.