Пример #1
0
        public static string GregToHijriMonthandYear(DateTime dtTime)
        {
            if (dtTime == DateTime.MinValue)
            {
                return("");
            }
            UmAlQuraCalendar calHijri = new UmAlQuraCalendar();
            string           weekday  = Convert.ToString(calHijri.GetDayOfWeek(dtTime));
            int CurrDayOfMonth        = calHijri.GetDayOfMonth(dtTime);
            int CurrMonth             = calHijri.GetMonth(dtTime);
            int Curryear = calHijri.GetYear(dtTime);

            return(Curryear.ToString() + " - " + CurrMonth.ToString());
        }
Пример #2
0
        public static string GregToHijriCompleteWithDay(DateTime dtTime)
        {
            if (dtTime == DateTime.MinValue)
            {
                return("");
            }
            UmAlQuraCalendar calHijri = new UmAlQuraCalendar();
            CultureInfo      info     = new CultureInfo("ar-sa");

            info.DateTimeFormat.Calendar = calHijri;
            string weekday        = Convert.ToString(calHijri.GetDayOfWeek(dtTime));
            int    CurrDayOfMonth = calHijri.GetDayOfMonth(dtTime);
            int    CurrMonth      = calHijri.GetMonth(dtTime);
            int    Curryear       = calHijri.GetYear(dtTime);

            return(string.Format("{0} {3}/{2}/{1}  هـ ", dtTime.ToString("dddd", info), CurrDayOfMonth.ToString(), CurrMonth.ToString(), Curryear.ToString()));
        }
Пример #3
0
        public static string GregToHijriTime(DateTime dtTime)
        {
            if (dtTime == DateTime.MinValue)
            {
                return("");
            }
            UmAlQuraCalendar calHijri = new UmAlQuraCalendar();
            CultureInfo      info     = new CultureInfo("ar-sa");

            info.DateTimeFormat.Calendar = calHijri;
            string weekday        = Convert.ToString(calHijri.GetDayOfWeek(dtTime));
            int    CurrDayOfMonth = calHijri.GetDayOfMonth(dtTime);
            int    CurrMonth      = calHijri.GetMonth(dtTime);
            int    Curryear       = calHijri.GetYear(dtTime);

            return(dtTime.ToString("hh:mm tt", info));
        }
Пример #4
0
        public int getWeekStartFrom()
        {
            var temp     = new UmAlQuraCalendar();
            var tempdate = new DateTime(_countYear, _countMonth + 1, 1);

            CultureInfo arSA = new CultureInfo("ar-SA");

            arSA.DateTimeFormat.Calendar = new UmAlQuraCalendar();
            var dateValue = DateTime.ParseExact(tempdate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture), "dd/MM/yyyy", arSA);

            var weekstartfrom = (int)temp.GetDayOfWeek(dateValue);

            if (weekstartfrom == 0)
            {
                return(1);
            }
            return(weekstartfrom);
        }