public void GetMonthName(DateTimeFormatInfo format, string[] expected)
 {
     for (int i = MinMonth; i <= MaxMonth; ++i)
     {
         Assert.Equal(expected[i], format.GetMonthName(i));
     }
 }
        /// <summary>
        /// Untuk mendapatkan nama bulan dalam format huruf berdasarkan angka bulan
        /// </summary>
        /// <param name="bulan">Diisi dengan angka bulan [1-12]</param>
        /// <param nama="shortName">Singkat nama bulan</param>
        /// <returns>Nama bulan [Januari - Desember]</returns>
        public static string GetBulanIndonesia(int bulan, bool shortName = false)
        {
            DateTimeFormatInfo dtfi = CultureInfo.GetCultureInfo("id-ID").DateTimeFormat;

            shortName = true;
            if (shortName)
            {
                string[] daftarBulan = dtfi.AbbreviatedMonthNames;
                return(daftarBulan[--bulan]);
            }
            return(dtfi.GetMonthName(bulan));
        }
Beispiel #3
0
        string DataAtual()
        {
            CultureInfo        culture = new CultureInfo("pt-BR");
            DateTimeFormatInfo dtfi    = culture.DateTimeFormat;

            int    dia       = DateTime.Now.Day;
            int    ano       = DateTime.Now.Year;
            string mes       = culture.TextInfo.ToTitleCase(dtfi.GetMonthName(DateTime.Now.Month));
            string diasemana = culture.TextInfo.ToTitleCase(dtfi.GetDayName(DateTime.Now.DayOfWeek));

            return(diasemana + ", " + dia + " de " + mes + " de " + ano);
        }
        public string MonthName(int month)
        {
            CultureInfo ci = new CultureInfo("es-MX");

            ci = new CultureInfo("es-MX");
            DateTimeFormatInfo dtinfo = ci.DateTimeFormat;
            var      mes      = dtinfo.GetMonthName(month);
            TextInfo textInfo = ci.TextInfo;
            string   mayusMes = textInfo.ToTitleCase(mes);

            return(mayusMes);
        }
        private void ddlmonth_load()
        {
            DateTimeFormatInfo month = new DateTimeFormatInfo();



            // ddlmonth.Items.Insert(0, new ListItem("Please select a Month", "0"));
            for (int i = 1; i < 13; i++)
            {
                ddlmonth.Items.Add(new ListItem(month.GetMonthName(i)));
            }
        }
Beispiel #6
0
 private static String FormatHebrewMonthName(DateTime time, int month, int repeatCount, DateTimeFormatInfo dtfi)
 {
     if (!dtfi.Calendar.IsLeapYear(dtfi.Calendar.GetYear(time)) && (month >= 7))
     {
         month++;
     }
     if (repeatCount == 3)
     {
         return(dtfi.GetAbbreviatedMonthName(month));
     }
     return(dtfi.GetMonthName(month));
 }
        public static string ToDateAndfWeekText(this DateTime date)
        {
            CultureInfo        culture        = new CultureInfo("pt-BR");
            DateTimeFormatInfo dateTimeFormat = culture.DateTimeFormat;

            string month     = culture.TextInfo.ToTitleCase(dateTimeFormat.GetMonthName(date.Month));
            string dayOfWeek = culture.TextInfo.ToTitleCase(dateTimeFormat.GetDayName(date.DayOfWeek));

            string data = dayOfWeek + ", " + date.Day + " de " + month + " de " + date.Year;

            return(data);
        }
Beispiel #8
0
        /// <summary>
        /// Obtiene el nombre del mes de una fecha específica
        /// </summary>
        /// <param name="date"></param>
        /// <returns>El nombre del mes</returns>
        public static string GetMonthByDate(DateTime date, bool firstCapitalLetter)
        {
            DateTimeFormatInfo formatDate = CultureInfo.CurrentCulture.DateTimeFormat;
            string             month      = formatDate.GetMonthName(date.Day);

            if (firstCapitalLetter)
            {
                month = GetFirstCapitalLetter(month);
            }

            return(month);
        }
Beispiel #9
0
    public void DataExtenso()
    {
        CultureInfo        culture = new CultureInfo("pt-BR");
        DateTimeFormatInfo dtfi    = culture.DateTimeFormat;
        int    dia       = DateTime.Now.Day;
        int    ano       = DateTime.Now.Year;
        string mes       = culture.TextInfo.ToTitleCase(dtfi.GetMonthName(DateTime.Now.Month));
        string diasemana = culture.TextInfo.ToTitleCase(dtfi.GetDayName(DateTime.Now.DayOfWeek));
        string data      = diasemana + ", " + dia + " de " + mes + " de " + ano;

        lblDataExtenso.Text = data;
    }
        public void TestStrFTime()
        {
            Liquid.UseRubyDateFormat = true;
            DateTimeFormatInfo dateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat;

            Assert.AreEqual(dateTimeFormat.GetMonthName(5), StandardFilters.Date(DateTime.Parse("2006-05-05 10:00:00"), "%B"));
            Assert.AreEqual(dateTimeFormat.GetMonthName(6), StandardFilters.Date(DateTime.Parse("2006-06-05 10:00:00"), "%B"));
            Assert.AreEqual(dateTimeFormat.GetMonthName(7), StandardFilters.Date(DateTime.Parse("2006-07-05 10:00:00"), "%B"));

            Assert.AreEqual(dateTimeFormat.GetMonthName(5), StandardFilters.Date("2006-05-05 10:00:00", "%B"));
            Assert.AreEqual(dateTimeFormat.GetMonthName(6), StandardFilters.Date("2006-06-05 10:00:00", "%B"));
            Assert.AreEqual(dateTimeFormat.GetMonthName(7), StandardFilters.Date("2006-07-05 10:00:00", "%B"));

            Assert.AreEqual("05/07/2006 10:00:00", StandardFilters.Date("05/07/2006 10:00:00", string.Empty));
            Assert.AreEqual("05/07/2006 10:00:00", StandardFilters.Date("05/07/2006 10:00:00", null));
            Assert.AreEqual(new DateTime(2006, 8, 3, 10, 0, 0).ToString(), StandardFilters.Date(new DateTime(2006, 8, 3, 10, 0, 0), string.Empty));
            Assert.AreEqual(new DateTime(2006, 8, 4, 10, 0, 0).ToString(), StandardFilters.Date(new DateTime(2006, 8, 4, 10, 0, 0), null));

            Assert.AreEqual("07/05/2006", StandardFilters.Date("2006-07-05 10:00:00", "%m/%d/%Y"));

            Assert.AreEqual("07/16/2004", StandardFilters.Date("Fri Jul 16 2004 01:00:00", "%m/%d/%Y"));

            Assert.AreEqual(null, StandardFilters.Date(null, "%M"));

            Assert.AreEqual("hi", StandardFilters.Date("hi", "%M"));

            Template template = Template.Parse(@"{{ hi | date:""%M"" }}");

            Assert.AreEqual("hi", template.Render(Hash.FromAnonymousObject(new { hi = "hi" })));
        }
Beispiel #11
0
        public void TestDate()
        {
            Liquid.UseRubyDateFormat = false;
            DateTimeFormatInfo dateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat;

            Assert.AreEqual(dateTimeFormat.GetMonthName(5), StandardFilters.Date(DateTime.Parse("2006-05-05 10:00:00"), "MMMM"));
            Assert.AreEqual(dateTimeFormat.GetMonthName(6), StandardFilters.Date(DateTime.Parse("2006-06-05 10:00:00"), "MMMM"));
            Assert.AreEqual(dateTimeFormat.GetMonthName(7), StandardFilters.Date(DateTime.Parse("2006-07-05 10:00:00"), "MMMM"));

            Assert.AreEqual(dateTimeFormat.GetMonthName(5), StandardFilters.Date("2006-05-05 10:00:00", "MMMM"));
            Assert.AreEqual(dateTimeFormat.GetMonthName(6), StandardFilters.Date("2006-06-05 10:00:00", "MMMM"));
            Assert.AreEqual(dateTimeFormat.GetMonthName(7), StandardFilters.Date("2006-07-05 10:00:00", "MMMM"));

            Assert.AreEqual("05/07/2006 10:00:00", StandardFilters.Date("05/07/2006 10:00:00", string.Empty));
            Assert.AreEqual("05/07/2006 10:00:00", StandardFilters.Date("05/07/2006 10:00:00", null));

            Assert.AreEqual(new DateTime(2006, 7, 5).ToString("MM/dd/yyyy"), StandardFilters.Date("2006-07-05 10:00:00", "MM/dd/yyyy"));

            Assert.AreEqual(new DateTime(2004, 7, 16).ToString("MM/dd/yyyy"), StandardFilters.Date("Fri Jul 16 2004 01:00:00", "MM/dd/yyyy"));

            Assert.AreEqual(null, StandardFilters.Date(null, "MMMM"));

            Assert.AreEqual("hi", StandardFilters.Date("hi", "MMMM"));

            Assert.AreEqual(DateTime.Now.ToString("MM/dd/yyyy"), StandardFilters.Date("now", "MM/dd/yyyy"));
            Assert.AreEqual(DateTime.Now.ToString("MM/dd/yyyy"), StandardFilters.Date("today", "MM/dd/yyyy"));
            Assert.AreEqual(DateTime.Now.ToString("MM/dd/yyyy"), StandardFilters.Date("Now", "MM/dd/yyyy"));
            Assert.AreEqual(DateTime.Now.ToString("MM/dd/yyyy"), StandardFilters.Date("Today", "MM/dd/yyyy"));

            Template template = Template.Parse(@"{{ hi | date:""MMMM"" }}");

            Assert.AreEqual("hi", template.Render(Hash.FromAnonymousObject(new { hi = "hi" })));
        }
Beispiel #12
0
 private string obtenerNombreMesNumero(int numeroMes) //Metodo que de vuelve el nombre del MES
 {
     try
     {
         DateTimeFormatInfo formatoFecha = CultureInfo.CurrentCulture.DateTimeFormat;
         string             nombreMes    = formatoFecha.GetMonthName(numeroMes);
         return(nombreMes);
     }
     catch
     {
         return("Desconocido");
     }
 }
Beispiel #13
0
        public static string GetMonthName(this string monthCode)
        {
            int monthNumber;

            if (!int.TryParse(monthCode, out monthNumber) || monthNumber < 1 || monthNumber > 12)
            {
                throw new InvalidMonthException("An invalid month number was passed", monthCode);
            }

            var formatInfo = new DateTimeFormatInfo();

            return(formatInfo.GetMonthName(monthNumber).ToLower());
        }
Beispiel #14
0
 /// <summary>
 /// Get the friendly name for a month index
 /// </summary>
 /// <param name="yearAndMonth">The year and month in yyyyMM format</param>
 /// <returns>The friendly month name</returns>
 protected virtual string GetFriendlyMonthName(int yearAndMonth)
 {
     if (yearAndMonth > 99999)
     {
         var month = int.Parse(yearAndMonth.ToString().Substring(4, 2));
         DateTimeFormatInfo dtft = new DateTimeFormatInfo();
         return(dtft.GetMonthName(month));
     }
     else
     {
         return("[unknown]");
     }
 }
Beispiel #15
0
        public string HourToLiteral(DateTime datahora)
        {
            CultureInfo        culture = new CultureInfo("pt-BR");
            DateTimeFormatInfo dtfi    = culture.DateTimeFormat;

            int    dia       = datahora.Day;
            int    ano       = datahora.Year;
            string mes       = culture.TextInfo.ToTitleCase(dtfi.GetMonthName(datahora.Month));
            string diasemana = culture.TextInfo.ToTitleCase(dtfi.GetDayName(datahora.DayOfWeek));
            string data      = diasemana + ", " + dia + " de " + mes + " de " + ano;

            return(data);
        }
 private string obtenerNombreMes(int numeroMes)
 {
     try
     {
         DateTimeFormatInfo formatoFecha = CultureInfo.CurrentCulture.DateTimeFormat;
         string             nombreMes    = formatoFecha.GetMonthName(numeroMes);
         return(nombreMes.ToUpper());
     }
     catch
     {
         return("Desconocido");
     }
 }
Beispiel #17
0
 ///<summary>Metodo retorna el nombre del mes</summary>
 ///<param name="monthNumber">Numero de mes</param>
 ///<history>
 ///[michan] 14/04/2016 Created
 ///</history>
 public static string GetMonthName(int monthNumber)
 {
     try
     {
         DateTimeFormatInfo dateFormat = CultureInfo.CurrentCulture.DateTimeFormat;
         string             MonthName  = dateFormat.GetMonthName(monthNumber);
         return(MonthName);
     }
     catch
     {
         return("Desconocido");
     }
 }
Beispiel #18
0
 public string getMes(int numeroMes)
 {
     try
     {
         DateTimeFormatInfo formatoFecha = CultureInfo.CurrentCulture.DateTimeFormat;
         string             nombreMes    = formatoFecha.GetMonthName(numeroMes);
         return(nombreMes);
     }
     catch
     {
         return("Desconocido");
     }
 }
Beispiel #19
0
 private string nombreMes(int numeroMes)
 {
     try
     {
         DateTimeFormatInfo formatoFecha = new DateTimeFormatInfo();
         string             nombreMes    = formatoFecha.GetMonthName(numeroMes);
         return(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(nombreMes));
     }
     catch (Exception)
     {
         return("Desconocido");
     }
 }
Beispiel #20
0
        private ReportInfo GetReportInfo()
        {
            CultureInfo        ci  = new CultureInfo("ru-RU");
            DateTimeFormatInfo mfi = ci.DateTimeFormat;

            var    monthNum     = (int)yenumcomboboxMonths.SelectedItem;
            string strMonthName = mfi.GetMonthName(monthNum).ToString();

            var year       = (int)ylistcomboboxYear.SelectedItem;
            var reportDate = new DateTime(year, monthNum, 1);

            var    monthNumMinus1     = reportDate.AddMonths(-1).Month;
            string strMonthNameMinus1 = mfi.GetMonthName(monthNumMinus1).ToString();

            var    monthNumMinus2     = reportDate.AddMonths(-2).Month;
            string strMonthNameMinus2 = mfi.GetMonthName(monthNumMinus2).ToString();

            return(new ReportInfo {
                Identifier = "Production.ProducedProduction",
                Parameters = new Dictionary <string, object> {
                    { "month_start", MonthStart(reportDate) },
                    { "month_end", MonthEnd(reportDate) },
                    { "month_minus_1_start", MonthStart(reportDate.AddMonths(-1)) },
                    { "month_minus_1_end", MonthEnd(reportDate.AddMonths(-1)) },
                    { "month_minus_2_start", MonthStart(reportDate.AddMonths(-2)) },
                    { "month_minus_2_end", MonthEnd(reportDate.AddMonths(-2)) },
                    { "month_name", strMonthName },
                    { "month_name_minus_1", strMonthNameMinus1 },
                    { "month_name_minus_2", strMonthNameMinus2 },

                    { "nomenclature_id", (entryreferenceNomenclature.Subject as Nomenclature)?.Id ?? -1 },
                    { "warehouse_id", (ycomboboxProduction.SelectedItem as Warehouse)?.Id ?? -1 },
                    { "creation_date", DateTime.Now },

                    { "nomenclature_footer_name", (entryreferenceNomenclature.Subject as Nomenclature)?.Name ?? "" },
                    { "warehouse_footer_name", (ycomboboxProduction.SelectedItem as Warehouse)?.Name ?? "" },
                }
            });
        }
Beispiel #21
0
        public static string DataPorExtenso()
        {
            CultureInfo        culture = new CultureInfo("pt-BR");
            DateTimeFormatInfo dtfi    = culture.DateTimeFormat;

            int    dia       = DateTime.Now.Day;
            int    ano       = DateTime.Now.Year;
            string mes       = culture.TextInfo.ToTitleCase(dtfi.GetMonthName(DateTime.Now.Month));
            string diasemana = culture.TextInfo.ToTitleCase(dtfi.GetDayName(DateTime.Now.DayOfWeek));
            string data      = diasemana + ", " + dia.ToString("00") + " de " + mes + " de " + ano;

            return(data);
        }
Beispiel #22
0
        private void frmRecibo_Load(object sender, EventArgs e)
        {
            CultureInfo        culture = new CultureInfo("pt-BR");
            DateTimeFormatInfo dtfi    = culture.DateTimeFormat;

            int    dia       = DateTime.Now.Day;
            int    ano       = DateTime.Now.Year;
            string mes       = culture.TextInfo.ToTitleCase(dtfi.GetMonthName(DateTime.Now.Month));
            string diasemana = culture.TextInfo.ToTitleCase(dtfi.GetDayName(DateTime.Now.DayOfWeek));
            string data      = diasemana + ", " + dia + " de " + mes + " de " + ano + ".";

            lbldata.Text = data;
        }
Beispiel #23
0
 public static string ObtenerNombreMesNumero(int numeroMes)
 {
     try
     {
         DateTimeFormatInfo formatoFecha = CultureInfo.CurrentCulture.DateTimeFormat;
         string             nombreMes    = formatoFecha.GetMonthName(numeroMes);
         return(nombreMes[0].ToString().ToUpper() + nombreMes.Substring(1));
     }
     catch
     {
         return("Desconocido");
     }
 }
Beispiel #24
0
        private void UtilidadLineas_Load(object sender, EventArgs e)
        {
            this.Icon        = ClasesSGUV.Propiedades.IconHalcoNET;
            log              = new Clases.Logs(ClasesSGUV.Login.NombreUsuario, this.AccessibleDescription, 0);
            this.MaximizeBox = true;
            try
            {
                Restricciones();
                CargarVendedores();
                CargarLinea();
                CargarSucursales();
                CargarGranCanales();
                int act   = DateTime.Now.Month;
                int ant_i = DateTime.Now.AddMonths(-3).Month;
                int ant_f = DateTime.Now.AddMonths(-1).Month;
                DateTimeFormatInfo fecha = CultureInfo.CurrentCulture.DateTimeFormat;

                string actual   = fecha.GetMonthName(DateTime.Now.Month);
                string atrasado = fecha.GetMonthName(ant_i) + "-" + fecha.GetMonthName(ant_f);

                lblVenta.Text    += " " + actual;
                lblUtilidad.Text += " " + actual;

                txtCliente.Clear();
                txtArticulo.Clear();
                txtCliente.Focus();
                txtVenta.Clear();
                txtUtilidadEstimada.Clear();

                gridLineas.DataSource    = null;
                gridArticulos.DataSource = null;

                //clbSucursal.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error inesperado: " + ex.Message, "HalcoNET", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    private void GetFloatingTransitionTimes()
    {
        ReadOnlyCollection <TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones();

        foreach (TimeZoneInfo zone in timeZones)
        {
            TimeZoneInfo.AdjustmentRule[] adjustmentRules = zone.GetAdjustmentRules();
            DateTimeFormatInfo            dateInfo        = CultureInfo.CurrentCulture.DateTimeFormat;
            foreach (TimeZoneInfo.AdjustmentRule adjustmentRule in adjustmentRules)
            {
                TimeZoneInfo.TransitionTime daylightStart = adjustmentRule.DaylightTransitionStart;
                if (!daylightStart.IsFixedDateRule)
                {
                    Console.WriteLine("{0}, {1:d}-{2:d}: Begins at {3:t} on the {4} {5} of {6}.",
                                      zone.StandardName,
                                      adjustmentRule.DateStart,
                                      adjustmentRule.DateEnd,
                                      daylightStart.TimeOfDay,
                                      ((WeekOfMonth)daylightStart.Week).ToString(),
                                      daylightStart.DayOfWeek.ToString(),
                                      dateInfo.GetMonthName(daylightStart.Month));
                }

                TimeZoneInfo.TransitionTime daylightEnd = adjustmentRule.DaylightTransitionEnd;
                if (!daylightEnd.IsFixedDateRule)
                {
                    Console.WriteLine("{0}, {1:d}-{2:d}: Ends at {3:t} on the {4} {5} of {6}.",
                                      zone.StandardName,
                                      adjustmentRule.DateStart,
                                      adjustmentRule.DateEnd,
                                      daylightEnd.TimeOfDay,
                                      ((WeekOfMonth)daylightEnd.Week).ToString(),
                                      daylightEnd.DayOfWeek.ToString(),
                                      dateInfo.GetMonthName(daylightEnd.Month));
                }
            }
        }
    }
        private static string getNombreMes(int mesNro)
        {
            try
            {
                DateTimeFormatInfo formatoFecha = CultureInfo.CurrentCulture.DateTimeFormat;
                string             nombreMes    = formatoFecha.GetMonthName(mesNro);

                return(nombreMes);
            }
            catch
            {
                return("No se encontró el mes");
            }
        }
Beispiel #27
0
        private void DDL_Month_Year_Bind()
        {
            DateTimeFormatInfo info = DateTimeFormatInfo.GetInstance(null);

            for (int i = 1; i < 13; i++)
            {
                ddlexpmonth.Items.Add(new ListItem(info.GetMonthName(i), i.ToString()));
            }

            for (int j = 2018; j < 2030; j++)
            {
                ddlexpyear.Items.Add(new ListItem(j.ToString()));
            }
        }
Beispiel #28
0
        } //---------------------

        //this procedure sets the combo month
        private void SetComboMonth()
        {
            //initialize the combo box month
            cboMonth.Items.Clear();

            DateTimeFormatInfo dateInfo = new DateTimeFormatInfo();

            for (int index = 1; index <= 12; index++)
            {
                cboMonth.Items.Add(dateInfo.GetMonthName(index));
            } //-----------------------

            cboMonth.SelectedIndex = _selectedDate.Month - 1;
        } //-------------------------------
Beispiel #29
0
    public static string[] getMonths(string langTag, string[] months)
    {
        CultureInfo ci;

        if (TryGetCultureInfoFromLangTag(langTag, out ci))
        {
            DateTimeFormatInfo dtfi = ci.DateTimeFormat;
            for (int i = 1; i <= 13; i++)
            {
                months[i - 1] = dtfi.GetMonthName(i);
            }
        }
        return(months);
    }
        private void Timer_Tick(object sender, EventArgs e)
        {
            CultureInfo        culture = new CultureInfo("pt-BR");
            DateTimeFormatInfo dtfi    = culture.DateTimeFormat;

            int    dia       = DateTime.Now.Day;
            int    ano       = DateTime.Now.Year;
            string mes       = culture.TextInfo.ToTitleCase(dtfi.GetMonthName(DateTime.Now.Month));
            string diasemana = culture.TextInfo.ToTitleCase(dtfi.GetDayName(DateTime.Now.DayOfWeek));
            string data      = diasemana + ", " + dia + " de " + mes + " de " + ano;


            LblDataHora.Text = data + "  " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;
        }
        public void obterDataPorExtenso()
        {
            CultureInfo        culture = new CultureInfo("pt-BR");
            DateTimeFormatInfo dtfi    = culture.DateTimeFormat;

            int    dia       = DateTime.Now.Day;
            int    ano       = DateTime.Now.Year;
            string mes       = culture.TextInfo.ToTitleCase(dtfi.GetMonthName(DateTime.Now.Month));
            string diasemana = culture.TextInfo.ToTitleCase(dtfi.GetDayName(DateTime.Now.DayOfWeek));
            string data      = diasemana + ", " + dia + " de " + mes + " de " + ano;

            Console.WriteLine(data);
            Console.ReadKey();
        }
        public void TestInvalidDayOfWeek()
        {
            DateTimeFormatInfo info1 = new DateTimeFormatInfo();
            Assert.Throws<ArgumentOutOfRangeException>(() =>
            {
                info1.GetMonthName(c_MIN_MONTH_VALUE - 1);
            });

            DateTimeFormatInfo info2 = new DateTimeFormatInfo();
            Assert.Throws<ArgumentOutOfRangeException>(() =>
           {
               info2.GetMonthName(c_MAX_MONTH_VALUE + 1);
           });
        }
Beispiel #33
0
 protected string GetPeriodDescription(int value, int year)
 {
     int groupBy = Utils.GetIntegerOnly(ddlGroupBy.SelectedValue);
     if (groupBy == 0) {
         DateTime firstDayOfYear = new DateTime(year, 1, 1);
         DateTime dateTime = firstDayOfYear.AddDays(value - 1);
         return dateTime.Day.ToString("00") + "." + dateTime.Month.ToString("00");
     } else if (groupBy == 1) {
         return "Week " + value;
     } else if (groupBy == 2) {
         DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
         return dtfi.GetMonthName(value);
     } else if (groupBy == 3) {
         return value.ToString();
     } else if (groupBy == 4) {
         return "Q" + value.ToString();
     }
     return value.ToString();
 }
    private bool VerificationHelper(DateTimeFormatInfo info, string[] expected, string errorno)
    {
        bool retval = true;

        for (int i = c_MIN_MONTH_VALUE; i <= c_MAX_MONTH_VALUE; ++i)
        {
            string actual = info.GetMonthName(i);
            if (actual != expected[i])
            {
                TestLibrary.TestFramework.LogError(errorno + "." + i, "GetAbbreviatedDayName returns wrong value");
                TestLibrary.TestFramework.LogInformation("WARNING[LOCAL VARIABLES] i = " + i + ", expected[i] = " + expected[i] + ", actual = " + actual);
                retval = false;
            }
        }

        return retval;
    }
    public bool NegTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("NegTest1: ArgumentOutOfRangeException should be thrown when dayofweek is not a valid System.DayOfWeek value. ");

        try
        {
            DateTimeFormatInfo info = new DateTimeFormatInfo();

            info.GetMonthName(c_MIN_MONTH_VALUE - 1);

            TestLibrary.TestFramework.LogError("101.1", "ArgumentOutOfRangeException is not thrown");
            retVal = false;
        }
        catch (ArgumentOutOfRangeException)
        {
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("101.2", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        try
        {
            DateTimeFormatInfo info = new DateTimeFormatInfo();

            info.GetMonthName(c_MAX_MONTH_VALUE + 1);

            TestLibrary.TestFramework.LogError("101.3", "ArgumentOutOfRangeException is not thrown");
            retVal = false;
        }
        catch (ArgumentOutOfRangeException)
        {
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("101.4", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
 private void VerificationHelper(DateTimeFormatInfo info, string[] expected)
 {
     for (int i = c_MIN_MONTH_VALUE; i <= c_MAX_MONTH_VALUE; ++i)
     {
         string actual = info.GetMonthName(i);
         Assert.Equal(expected[i], actual);
     }
 }
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         for (int day = 1; day < 32; day++)
         {
             ListItem li = new ListItem();
             li.Text = day.ToString();
             li.Value = day.ToString();
             ddldate.Items.Add(li);
         }
         DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
         for (int month = 1; month < 13; month++)
         {
             ListItem li = new ListItem();
             li.Text = dtfi.GetMonthName(month);
             li.Value = month.ToString();
             ddlmonth.Items.Add(li);
         }
         int thisYear = System.DateTime.Now.Year;
         int startYear = thisYear - 16;
         for (int year = startYear; year > startYear - 100; year--)
         {
             ListItem li = new ListItem();
             li.Text = year.ToString();
             li.Value = year.ToString();
             ddlyear.Items.Add(li);
         }
     }
 }