示例#1
0
        /// <summary>
        /// Return PersianDate object that bind from persian string date
        /// </summary>
        /// <param name="PersianStringDate">it must be complete like 1392/01/01 </param>
        /// <returns></returns>
        public static PersianDate GetDate(string PersianStringDate)
        {
            PersianDate PD = new PersianDate();

            PD.PersianDateString = PersianStringDate;
            return(PD);
        }
示例#2
0
 public static PersianDate ToPersian(this DateTime date)
 {
     try
     {
         return(PersianDate.GetDate(date));
     }
     catch { return(null); }
 }
示例#3
0
 public static string ToPersianShort(this DateTime date, bool ContainsTime = false)
 {
     try
     {
         return(PersianDate.GetDate(date).ToShortString() + " " + (ContainsTime ? date.ToString("HH:mm:ss") : ""));
     }
     catch { return(""); }
 }
示例#4
0
 public PersianDate AddYears(int count)
 {
     return(PersianDate.GetDate(this.MiladyDate.AddYears(count)));
 }