JapaneseLunisolarCalendar.GetEra(DateTime) Method


Retrieves the era that corresponds to the specified DateTime.

 override int GetEra(DateTime time);
public override int GetEra (DateTime time);
override this.GetEra : DateTime -> int
Public Overrides Function GetEra (time As DateTime) As Integer



The DateTime to read.


An integer that represents the era specified in the time parameter.



Eras in the Japanese calendars are based on the emperor's reign and are therefore expected to change. For example, May 1, 2019 marked the beginning of the Reiwa era in the JapaneseCalendar and JapaneseLunisolarCalendar. Such a change of era affects all applications that use these calendars. See Handling a new era in the Japanese calendar in .NET for more information and to determine whether your applications are affected. See Prepare your application for the Japanese era change for information on testing your applications on Windows systems to ensure their readiness for the era change. See Working with eras for features in .NET that support calendars with multiple eras and for best practices when working with calendars that support multiple eras.

Applies to