Created
April 20, 2019 10:00
-
-
Save telfaria/01c8fa205198ec0ca02e38568bfeb120 to your computer and use it in GitHub Desktop.
Japanise new era test program.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ReiwaTestConsole | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var jc = new System.Globalization.JapaneseCalendar(); | |
var cultureJp = new System.Globalization.CultureInfo("ja-JP",false); | |
cultureJp.DateTimeFormat.Calendar = jc; | |
Console.WriteLine("Input-2019/04/30"); | |
DateTime heisei_dt = new DateTime(2019, 04, 30); | |
Console.WriteLine("default culture-yyyy/MM/dd"); | |
Console.WriteLine(heisei_dt.ToString("yyyy/MM/dd")); | |
Console.WriteLine("Japanese Culture - ggyy/MM/dd"); | |
Console.WriteLine(heisei_dt.ToString("ggyy/MM/dd",cultureJp)); | |
Console.WriteLine(); | |
Console.WriteLine("Input-2019/05/01"); | |
DateTime reiwa_dt = new DateTime(2019, 05, 01); | |
Console.WriteLine("default culture-yyyy/MM/dd"); | |
Console.WriteLine(reiwa_dt.ToString("yyyy/MM/dd")); | |
Console.WriteLine("Japanese Culture - ggyy/MM/dd"); | |
Console.WriteLine(reiwa_dt.ToString("ggyy/MM/dd", cultureJp)); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment