Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Update for Silverlight DateTime calculations to handle new Japanese eras


View products that this article applies to.

About this update

On May 1, 2019, the new era in the Japanese calendar begins. This is the first transition from one era to another since January 1989. This update for Microsoft Silverlight fixes DateTime calculations to handle and format new eras in the Japanese calendar.

Japanese era supported features

Range-Relaxation

When the Heisei (平成) era ends on April 30, 2019 (Heisei (平成) 31), and the new era begins on May 1, 2019, “平成 31 年 5 月 1 日” becomes invalid. We have relaxed our parsers to allow future and past dates (both Gregorian and Japanese dates) to be converted into a relevant Japanese era date without throwing an exception.

For example, for the previous Japanese Showa Era, the maximum era year is 64. Current Silverlight code cannot parse the date if the year of the date is greater than 64 for the current era. If it tries, it will throw an exception.  This update fixes this problem and parses the date even if the year is greater than maximum era year.

The following example illustrates the change:

DateTime.Parse(“昭和 70/1/1 0:00:00", new CultureInfo("ja-JP") { DateTimeFormat = { Calendar = new JapaneseCalendar() } })

This example won’t throw an exception. Instead, it will parse the date successfully and return 1/1/1995 12:00:00 AM (70 – 64 = 6. (The Heisei era started in 1989; 1989+6 = 1995.)

You will also be able to convert future dates in Heisei to the new Japanese era after the new Japanese era name is announced.
 

Gannen (元年) for the first year of the Japanese era

In historical practice, the first year of the era is indicated by a special character “Gan (元)” (whose Kanji character means “origin” or “beginning”) instead of the number “Ichi (1)”. The first year “Gannen (元年)” continues until the end date of the Gregorian calendar year, December 31.

This update will allow Silverlight to parse Gannen (元年) characters successfully. 

Note Silverlight will continue to return 01 and not if Silverlight is asked to format the first date of the era. This can be fixed by having developers replace the “01” year with the “元” year.  A simple string replacement would accomplish this.

The following examples detail how Silverlight handles formatting and parsing of Gannen (元年).

Formatting

string pattern = "gg yyyy'\u5E74' MM'\u6708' dd'\u65E5'"; // "gg yyyy'年' MM'月' dd'日'"

DateTime dt = new DateTime(1989, 01, 08); // Start of Heisei Era

string formattedDate = dt.ToString(pattern, jpnFormat);

Behavior before update: formattedDate is "平成 01年 01月 08日"
Behavior after update: formattedDate is "平成 01年 01月 08日"

There is no change in behavior from what existed before the update.

Parsing

Ichinen (1 年)

DateTime.TryParseExact("平成 01年 01月 08日", pattern, jpnFormat, DateTimeStyles.None, out parsedDate)

Behavior before update: Returns true and has a parsedDate of {1/8/1989 12:00:00 AM}
Behavior after update: Returns true and has a parsedDate of {1/8/1989 12:00:00 AM}

There is no change in behavior from what existed before the update.

Gannen (元年)

DateTime.TryParseExact("平成元年 01月 08日", pattern, jpnFormat, DateTimeStyles.None, out parsedDate)

Behavior before update: Returns false and has a parsedDate of {1/1/0001 12:00:00 AM}
Behavior after update: Returns true and has a parsedDate of {1/8/1989 12:00:00 AM}

↑ Back to the top


How to get this update

Method 1: Microsoft Silverlight site

The Silverlight installer includes all previous updates in addition to this update. To install the latest version of Silverlight, go to the following Microsoft website: Get Microsoft Silverlight.
 

Method 2: Microsoft Update

This update is available from Microsoft Update. For more information about how to run Microsoft Update, see How to get an update through Windows Update.
 

Method 3: Microsoft Download Center

You can get the standalone update package through the Microsoft Download Center. Follow the installation instructions on the download page to install the update.

Download Download the Silverlight 5 package now.

For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.

↑ Back to the top


References

Learn about the terminology that Microsoft uses to describe software updates.

↑ Back to the top


Keywords: kb, atdownload, kbexpertiseadvanced, kbfix, kbsurveynew

↑ Back to the top

Article Info
Article ID : 4481252
Revision : 12
Created on : 4/10/2020
Published on : 4/10/2020
Exists online : False
Views : 250