示例#1
0
        private void calc()
        {
            DaysInMonth = DateConvertor.GetDaysInNepaliMoth(Year, Month);
            NepaliDate np = new NepaliDate(Year, Month, 1);

            StartDate = DateConvertor.GetEnglishDate(np.ToString());
            np.Day    = DaysInMonth;
            EndDate   = DateConvertor.GetEnglishDate(np.ToString());
        }
        public static String ToNepaliDate(DateTime englishDate)
        {
            NepaliDate dt = null;

            try
            {
                dt = GetNepaliDate(englishDate);
                if (dt != null)
                {
                    return(dt.ToString());
                }
                return(string.Empty);
            }
            catch (Exception ex)
            {
                return(string.Empty);
            }
        }
        // Added by jayan  June 22 2009
        public static String GetFiscalYear(String npdate)  //Function for returning fiscal year from a given nepali date
        {
            NepaliDate date1 = new NepaliDate(npdate);
            String     fyear;
            int        mon             = date1.Month;
            int        yea             = date1.Year;
            int        lessyear        = (yea - 1);
            int        greatyear       = (yea + 1);
            String     fiscalstartdate = yea.ToString() + "/04/01";
            int        x = npdate.CompareTo(fiscalstartdate);

            if (x == 1)
            {
                fyear = yea.ToString() + "/" + greatyear.ToString();;
            }
            else
            {
                fyear = lessyear.ToString() + "/" + yea.ToString();
            }
            return(fyear);
        }