コード例 #1
0
        public static string ToLongDateString(DateTime?date, CultureInfo culture)
        {
            string             result = string.Empty;
            DateTimeFormatInfo format = GetDateFormat(culture);

            if (date.HasValue && format != null)
            {
                //result = date.Value.Date.ToString(format.LongDatePattern, format);
                result = PersianCalendarHelper.ToCurrentCultureString(date.Value.Date, format.LongDatePattern, format);
            }

            return(result);
        }
コード例 #2
0
        public static string ToAbbreviatedMonthString(DateTime?date, CultureInfo culture)
        {
            string             result = string.Empty;
            DateTimeFormatInfo format = GetDateFormat(culture);

            if (date.HasValue && format != null)
            {
                //string[] monthNames = format.AbbreviatedMonthNames;
                //if (monthNames != null && monthNames.Length > 0)
                //{
                //    result = monthNames[(date.Value.Month - 1) % monthNames.Length];
                //}
                result = PersianCalendarHelper.ToCurrentCultureString(date.Value, "MMM", format);
            }

            return(result);
        }