Abp.Timing.Timezone.TimezoneHelper.IanaToWindows(string)

Here are the examples of the csharp api class Abp.Timing.Timezone.TimezoneHelper.IanaToWindows(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

View license
[Theory]
        [InlineData("America/Los_Angeles", "Pacific Standard Time")]
        [InlineData("America/Argentina/San_Luis", "Argentina Standard Time")]
        [InlineData("Etc/UTC", "UTC")]
        [InlineData("America/Godthab", "Greenland Standard Time")]
        [InlineData("Europe/London", "GMT Standard Time")]
        [InlineData("Europe/Berlin", "W. Europe Standard Time")]
        [InlineData("Europe/Paris", "Romance Standard Time")]
        [InlineData("Asia/Amman", "Jordan Standard Time")]
        [InlineData("Europe/Zaporozhye", "FLE Standard Time")]
        [InlineData("Asia/Choibalsan", "Ulaanbaatar Standard Time")]
        public void Iana_Timezone_Id_To_Windows_Tests(string ianaTimezoneId, string windowsTimezoneId)
        {
            TimezoneHelper.IanaToWindows(ianaTimezoneId).ShouldBe(windowsTimezoneId);
        }

2. Example

View license
[Fact]
        public void Should_Throw_Exception_For_Unknown_Iana_Timezone_Id()
        {
            Should.Throw<Exception>(() =>
            {
                TimezoneHelper.IanaToWindows("cba");
            });
        }

3. Example

Project: aspnetboilerplate
Source File: TimezoneHelper.cs
View license
public static DateTime? ConvertTimeByIanaTimeZoneId(DateTime? date, string fromIanaTimeZoneId, string toIanaTimeZoneId)
        {
            if (!date.HasValue)
            {
                return null;
            }

            var sourceTimeZone = TimeZoneInfo.FindSystemTimeZoneById(IanaToWindows(fromIanaTimeZoneId));
            var destinationTimeZone = TimeZoneInfo.FindSystemTimeZoneById(IanaToWindows(toIanaTimeZoneId));

            return TimeZoneInfo.ConvertTime(date.Value, sourceTimeZone, destinationTimeZone);
        }