protected override void OnCreate(Bundle bundle) { // If these are not used the ToString for DateTime throws an exception in some cultures // For more information: https://forums.xamarin.com/discussion/42899/datetime-tostring-throws-argumentoutofrangeexception-in-thai-locale var c1 = new System.Globalization.ChineseLunisolarCalendar(); var c2 = new System.Globalization.GregorianCalendar(); var c3 = new System.Globalization.HebrewCalendar(); var c4 = new System.Globalization.HijriCalendar(); var c5 = new System.Globalization.JapaneseCalendar(); var c6 = new System.Globalization.JapaneseLunisolarCalendar(); var c7 = new System.Globalization.JulianCalendar(); var c8 = new System.Globalization.KoreanCalendar(); var c9 = new System.Globalization.KoreanLunisolarCalendar(); var c10 = new System.Globalization.PersianCalendar(); var c11 = new System.Globalization.TaiwanCalendar(); var c12 = new System.Globalization.TaiwanLunisolarCalendar(); var c13 = new System.Globalization.ThaiBuddhistCalendar(); var c14 = new System.Globalization.UmAlQuraCalendar(); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(bundle); CrossCurrentActivity.Current.Init(this, bundle); PermissionsHelper.Activity = this; this.SetTheme(Resource.Style.Theme_Design_Light); //CachedImageRenderer.Init(false); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(false); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // If these are not used the ToString for DateTime throws an exception in some cultures // For more information: https://forums.xamarin.com/discussion/42899/datetime-tostring-throws-argumentoutofrangeexception-in-thai-locale var c1 = new System.Globalization.ChineseLunisolarCalendar(); var c2 = new System.Globalization.GregorianCalendar(); var c3 = new System.Globalization.HebrewCalendar(); var c4 = new System.Globalization.HijriCalendar(); var c5 = new System.Globalization.JapaneseCalendar(); var c6 = new System.Globalization.JapaneseLunisolarCalendar(); var c7 = new System.Globalization.JulianCalendar(); var c8 = new System.Globalization.KoreanCalendar(); var c9 = new System.Globalization.KoreanLunisolarCalendar(); var c10 = new System.Globalization.PersianCalendar(); var c11 = new System.Globalization.TaiwanCalendar(); var c12 = new System.Globalization.TaiwanLunisolarCalendar(); var c13 = new System.Globalization.ThaiBuddhistCalendar(); var c14 = new System.Globalization.UmAlQuraCalendar(); AnalyticsHelper.Initialize(Xamarin.Forms.Device.iOS); global::Xamarin.Forms.Forms.Init(); CachedImageRenderer.Init(); LoadApplication(new App()); UITextField.Appearance.TintColor = Xamarin.Forms.Color.FromHex("#2548D8").ToUIColor(); #if __TESTS__ Xamarin.Calabash.Start(); #endif return(base.FinishedLaunching(app, options)); }
static void JapaneseTest() { var dt = DateTime.Now; Console.WriteLine(dt); //日本日历 var jpci = new System.Globalization.CultureInfo("ja-JP"); var jpcal = new System.Globalization.JapaneseCalendar(); jpci.DateTimeFormat.Calendar = jpcal; Console.WriteLine(dt.ToString("ggyy/MM/dd", jpci)); }
public void AFVTau(System.Runtime.Versioning.ResourceExposureAttribute Bhpjwb, System.Web.UI.WebControls.MailMessageEventHandler lcclVgz, System.ComponentModel.DesignOnlyAttribute LJoU, System.Security.Cryptography.X509Certificates.X509ChainPolicy JAthRKz) { System.Web.Configuration.ProfilePropertySettingsCollection YPN = new System.Web.Configuration.ProfilePropertySettingsCollection(); System.Web.UI.WebControls.CommandEventArgs coGHdY = new System.Web.UI.WebControls.CommandEventArgs("wyKJlYHiXhmuI", 939670288); System.Windows.Forms.TreeNodeConverter TQkITGk = new System.Windows.Forms.TreeNodeConverter(); System.CodeDom.CodeNamespaceImport AMuF = new System.CodeDom.CodeNamespaceImport(); System.Runtime.Remoting.Channels.TransportHeaders ZPhf = new System.Runtime.Remoting.Channels.TransportHeaders(); System.Web.Configuration.ProfileSettingsCollection bGxTyT = new System.Web.Configuration.ProfileSettingsCollection(); System.Web.UI.Triplet NKo = new System.Web.UI.Triplet(94201957, 204067286, 181795136); System.Web.UI.WebControls.CreateUserWizardStep YVz = new System.Web.UI.WebControls.CreateUserWizardStep(); System.Net.Configuration.HttpCachePolicyElement gvpb = new System.Net.Configuration.HttpCachePolicyElement(); System.Runtime.InteropServices.IDispatchImplAttribute JMUwahj = new System.Runtime.InteropServices.IDispatchImplAttribute(-658); System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute WvLbFF = new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute("tibFWnWRwJiTRnijF"); System.Web.UI.WebControls.MenuItemCollection QjImiIB = new System.Web.UI.WebControls.MenuItemCollection(new System.Web.UI.WebControls.MenuItem()); System.ComponentModel.WarningException Edl = new System.ComponentModel.WarningException("hLJ", "RxUjFInvYnsN"); System.Web.UI.WebControls.CreateUserWizardStep tnLG = new System.Web.UI.WebControls.CreateUserWizardStep(); System.Threading.ThreadExceptionEventArgs oVqHzS = new System.Threading.ThreadExceptionEventArgs(new System.Exception()); System.Windows.Forms.ToolStripPanel ubWJjW = new System.Windows.Forms.ToolStripPanel(); System.Windows.Forms.CheckedListBox vQnk = new System.Windows.Forms.CheckedListBox(); System.Data.EvaluateException lZuPd = new System.Data.EvaluateException("VDiWDw"); System.Collections.Specialized.OrderedDictionary NrEiCx = new System.Collections.Specialized.OrderedDictionary(); System.Web.Configuration.ExpressionBuilderCollection rKe = new System.Web.Configuration.ExpressionBuilderCollection(); System.Security.VerificationException gjQbpO = new System.Security.VerificationException("HdwsMd", new System.Exception()); System.Web.UI.WebControls.GridView hKm = new System.Web.UI.WebControls.GridView(); System.Collections.Specialized.StringCollection xaB = new System.Collections.Specialized.StringCollection(); System.Runtime.InteropServices.PreserveSigAttribute eVvQ = new System.Runtime.InteropServices.PreserveSigAttribute(); System.IO.IODescriptionAttribute aNN = new System.IO.IODescriptionAttribute("VPjQMtDWfg"); System.ComponentModel.BooleanConverter FvgYn = new System.ComponentModel.BooleanConverter(); System.Web.UI.WebControls.DetailsViewInsertedEventArgs PwpT = new System.Web.UI.WebControls.DetailsViewInsertedEventArgs(1190630802, new System.Exception()); System.Windows.Forms.ImageList xRwZA = new System.Windows.Forms.ImageList(); System.Globalization.JapaneseCalendar afnDCPz = new System.Globalization.JapaneseCalendar(); System.Web.Configuration.PassportAuthentication MfCQkqL = new System.Web.Configuration.PassportAuthentication(); System.Runtime.Remoting.RemotingException naDyQF = new System.Runtime.Remoting.RemotingException(); System.MissingFieldException ubX = new System.MissingFieldException("wtnxbHmoATXw", new System.Exception()); System.Web.UI.HtmlControls.HtmlInputText VLBD = new System.Web.UI.HtmlControls.HtmlInputText("gXFG"); System.Runtime.Remoting.ActivatedServiceTypeEntry doa = new System.Runtime.Remoting.ActivatedServiceTypeEntry("CWPQ", "eKcxOFlcYMF"); System.MissingMethodException PSQBjgG = new System.MissingMethodException("BQoFN", new System.Exception()); System.Windows.Forms.FolderBrowserDialog nyTD = new System.Windows.Forms.FolderBrowserDialog(); System.Runtime.InteropServices.OutAttribute sBWytdq = new System.Runtime.InteropServices.OutAttribute(); System.Web.UI.WebControls.FormViewUpdateEventArgs wrFEU = new System.Web.UI.WebControls.FormViewUpdateEventArgs(614564652); System.ArgumentOutOfRangeException Tyfmqs = new System.ArgumentOutOfRangeException("XOLQzNCqfjKHnxfq", new System.Exception()); System.Web.UI.ControlBuilder ubZZw = new System.Web.UI.ControlBuilder(); System.Windows.Forms.FlowLayoutPanel huyOf = new System.Windows.Forms.FlowLayoutPanel(); System.Configuration.UserSettingsGroup VkIAhTM = new System.Configuration.UserSettingsGroup(); System.Security.Cryptography.MD5CryptoServiceProvider ixAZ = new System.Security.Cryptography.MD5CryptoServiceProvider(); System.Runtime.Remoting.Metadata.SoapParameterAttribute QHvwhq = new System.Runtime.Remoting.Metadata.SoapParameterAttribute(); System.Reflection.AssemblyInformationalVersionAttribute IGrOTW = new System.Reflection.AssemblyInformationalVersionAttribute("qdWByXvKzB"); System.Windows.Forms.SelectionRangeConverter rwbzo = new System.Windows.Forms.SelectionRangeConverter(); Microsoft.SqlServer.Server.SqlTriggerAttribute PsugLs = new Microsoft.SqlServer.Server.SqlTriggerAttribute(); System.Globalization.ThaiBuddhistCalendar iMwCC = new System.Globalization.ThaiBuddhistCalendar(); }
static void Main(string[] args) { var dt = DateTime.Parse("2019/06/02"); Console.WriteLine(dt); Console.WriteLine("----------------------------------"); //日本日历 var jpci = new System.Globalization.CultureInfo("ja-JP"); var jpcal = new System.Globalization.JapaneseCalendar(); jpci.DateTimeFormat.Calendar = jpcal; Console.WriteLine(dt.ToString("ggyy/MM/dd", jpci)); Console.WriteLine("----------------------------------"); //中国农历 var zhcal = new System.Globalization.ChineseLunisolarCalendar(); int yearIndex = zhcal.GetSexagenaryYear(dt); int yTG = zhcal.GetCelestialStem(yearIndex); int yDZ = zhcal.GetTerrestrialBranch(yearIndex); Console.WriteLine($"{_celestialStem[yTG-1]}{_terrestrialBranch[yDZ-1]} {_chineseZodiac[yDZ - 1]}年 {_chineseMonth[zhcal.GetMonth(dt)-1]}月{_chineseDay[zhcal.GetDayOfMonth(dt)-1]}"); }
public static int GetJapaneseYear(DateTime time) { var calendar = new System.Globalization.JapaneseCalendar(); return calendar.GetYear(time); }