I'm trying to get the long name for the timezone from System.TimeZone. This is how I'm trying to do it:
And the result that i'm getting in console is:
But what I need is the long name:
Eastern Standard Time
I looked into C# documentation (http://msdn.microsoft.com/en-us/library/system.timezone.currenttimezone(v=vs.110).aspx) and noticed that the .Net library is returning what I need but for some reason Xamarin (mono) just gives me the abbreviation.
I have checked this issue and able to reproduce it. Steps are:
1. Created an android project.
2. Added code of TimeZone as mentioned above.
3. Build and deploy it.
Actual Result : IST
Expected Result : India Daylight Time
Screencast info :
=== Xamarin Studio ===
Version 4.2.3 (build 60)
Installation UUID: 400bab6b-f5cd-4e84-a1d1-39f9d6414cb1
Microsoft .NET 4.0.30319.18449
GTK+ 2.24.22 theme: MS-Windows
=== Xamarin.Android ===
Version: 4.12.2 (Trial Edition)
Android SDK: E:\SDK\AndroidSDK
Supported Android versions:
1.6 (API level 4)
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
3.2 (API level 13)
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 (x86)\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: 402030060
Build date: 2014-03-05 16:53:54Z
Xamarin addins: f8a9589b57c2bfab2ccd73c880e7ad81e3ecf044
=== Operating System ===
Windows 6.2.9200.0 (64-bit)
> Xamarin (mono) just gives me the abbreviation.
Implementation details ;-)
Mono uses strftime(3) in order to obtain the timezone name, and strftime(3) only provides a single way to get the timezone name, which always provides the abbreviation, not the 'long" name:
Consequently, there is no way for Mono to provide longer timezone names without separately creating and including a timezone database.
This is also the behavior on desktop mono:
Furthermore, System.TimeZoneInfo is no better in this regard (on OS X, anyway), providing the abbreviations and not the full names, because timezone DB doesn't contain that information. (zone.tab appears to, maybe, but the compiled e.g. /usr/share/zoneinfo/America/New_York file does not.)