GetMonth() public méthode

Gets the month in the specified DateTime.
Month 1 indicates Farvardin, month 2 indicates Ordibehesht, month 3 indicates Khordad, month 4 indicates Tir, month 5 indicates Amordad, month 6 indicates Shahrivar, month 7 indicates Mehr, month 8 indicates Aban, month 9 indicates Azar, month 10 indicates Dey, month 11 indicates Bahman, and month 12 indicates Esfand.
public GetMonth ( System.DateTime time ) : int
time System.DateTime The DateTime instance to read.
Résultat int
        private void InitializeData()
        {
            DataLayer.BeginTransaction();
            this.cmbAccountantEmployees.DataSource = DataLayer.GetAccountantDoctors();

            PersianCalendar pc = new PersianCalendar();
            cmbYear.SelectedItem = pc.GetYear(DateTime.Now).ToString();
            cmbMonth.SelectedIndex = pc.GetMonth(DateTime.Now) - 1;
        }
 public void Can_Get_Correct_Month_From_Day_Value()
 {
     Assert.AreEqual(1, calendar.GetMonth(new PersianDate(1384, 1, 10)));
     Assert.AreEqual(2, calendar.GetMonth(new PersianDate(1384, 2, 22)));
     Assert.AreEqual(3, calendar.GetMonth(new PersianDate(1384, 3, 30)));
     Assert.AreEqual(4, calendar.GetMonth(new PersianDate(1384, 4, 1)));
     Assert.AreEqual(5, calendar.GetMonth(new PersianDate(1384, 5, 18)));
     Assert.AreEqual(6, calendar.GetMonth(new PersianDate(1384, 6, 2)));
     Assert.AreEqual(7, calendar.GetMonth(new PersianDate(1384, 7, 4)));
     Assert.AreEqual(8, calendar.GetMonth(new PersianDate(1384, 8, 12)));
     Assert.AreEqual(9, calendar.GetMonth(new PersianDate(1384, 9, 13)));
     Assert.AreEqual(10, calendar.GetMonth(new PersianDate(1384, 10, 1)));
     Assert.AreEqual(11, calendar.GetMonth(new PersianDate(1384, 11, 8)));
     Assert.AreEqual(12, calendar.GetMonth(new PersianDate(1384, 12, 5)));
 }