Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rh-KIMATA/896b67928942566a9569bfa0c2ab0e18 to your computer and use it in GitHub Desktop.
Save rh-KIMATA/896b67928942566a9569bfa0c2ab0e18 to your computer and use it in GitHub Desktop.
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