Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Registry editing to Japanese ”Reiwa” era support.
# Get
Get-Item -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras';
# Add
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras' -Name '2019 05 01' -Value '令和_令_Reiwa_R';
# Edit
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras' -Name '2019 05 01' -Value '令和_令_Reiwa_R';
# Remove
Remove-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras' -Name '2019 05 01';
# Display
[CultureInfo] $culture = [CultureInfo]::New("ja-JP");
[Globalization.JapaneseCalendar] $culture.DateTimeFormat.Calendar = [System.Globalization.JapaneseCalendar]::new();
([Datetime]'2019/5/1').ToString('ggy年', $culture);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.