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}

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×