public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); CultureInfo info = new CultureInfo("fa-Ir"); PersianCultureHelper.SetPersianOptions(info); Thread.CurrentThread.CurrentCulture = info; string str = DateTime.Now.ToString("yyyy/MM/dd"); }
/// <summary> /// Set the page culture and load calendar if required /// </summary> protected override void InitializeCulture() { string lang = SnitzCookie.GetDefaultLanguage(); if (lang != null) { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(lang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang); } if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName == "fa") { CultureInfo info = Thread.CurrentThread.CurrentCulture; PersianCultureHelper.SetPersianOptions(info); Thread.CurrentThread.CurrentCulture = info; } base.InitializeCulture(); }