public Instant ParseTimeDate(string timeDate, bool withoutDaylightSaving = false, MxCultureInfo.FormatType formatType = MxCultureInfo.FormatType.DateTime, bool longFormat = false, string cultureTab = null) { var rc = ExtNodatime.InstantError; var cookies = new MxCookies(HttpContextAccessor); if (SupportedCultures.IsSupported(cultureTab) == false) { cultureTab = SupportedCultures.GetCultureTab(cookies.GetValue(MxSupportedCultures.CookieName)); } if (timeDate.ParseDateTime(DateTimeZoneProviders.Tzdb[SupportedTimeZones.GetTzDbName(cultureTab)], cultureTab, withoutDaylightSaving, formatType, longFormat, out var result)) { rc = result; } return(rc); }
public string InstantToString(Instant timeInstant, string cultureTab = null, bool withoutDaylightSaving = false, MxCultureInfo.FormatType formatType = MxCultureInfo.FormatType.DateTime, bool longFormat = false) { var rc = "[error]"; try { var cookies = new MxCookies(HttpContextAccessor); if (SupportedCultures.IsSupported(cultureTab) == false) { cultureTab = SupportedCultures.GetCultureTab(cookies.GetValue(MxSupportedCultures.CookieName)); } rc = timeInstant.ToString(cultureTab, DateTimeZoneProviders.Tzdb[SupportedTimeZones.GetTzDbName(cultureTab)]); } catch (Exception) { //ignore } return(rc); }
public string GetCultureTab() { var cookies = new MxCookies(HttpContextAccessor); return(SupportedCultures.GetCultureTab(cookies.GetValue(MxSupportedCultures.CookieName))); }