/// <summary> /// /// </summary> /// <param name="dateTime">The date to convert.</param> /// <param name="formate">The formate of date to convert.</param> /// <returns></returns> public static string ToDateString(this DateTime dateTime, EnumCommonology.DateTimeForamte formate) { return(dateTime.ToString(formate.GetAttribute <DateAttribute>()?.Value)); }
/// <summary> /// /// </summary> /// <param name="dateTime">The UTC date to convert.</param> /// <param name="timeZoneId">The time zone to convert date to.</param> /// <param name="formate">The formate of date to convert.</param> /// <returns></returns> public static string ToLocalDateString(this DateTime dateTime, string timeZoneId, EnumCommonology.DateTimeForamte formate) { return(dateTime.ToLocalDateTime(timeZoneId).ToString(formate.GetAttribute <DateAttribute>()?.Value)); }
/// <summary> /// /// </summary> /// <param name="dateTime">The date to convert.</param> /// <param name="formate">The formate of date to convert.</param> /// <returns></returns> public static string ToDateString(this DateTime?dateTime, EnumCommonology.DateTimeForamte formate) { return(dateTime.HasValue ? dateTime.Value.ToDateString(formate) : string.Empty); }
/// <summary> /// /// </summary> /// <param name="dateTime">The UTC date to convert.</param> /// <param name="timeZoneId">The time zone to convert date to.</param> /// <param name="formate">The formate of date to convert.</param> /// <returns></returns> public static string ToLocalDateString(this DateTime?dateTime, string timeZoneId, EnumCommonology.DateTimeForamte formate) { return(dateTime.HasValue ? dateTime.Value.ToLocalDateString(timeZoneId, formate) : string.Empty); }