I am in ethiopia and we have 13 monthes. 12 of them with 30 days each and 13th month with 5 or 6 days. I want to sort my data by date using the bindingsource sort method. But to do that I need to set my date field a date data type. When i set the datatype to date, i can't enter some values like 13 for the month value and 30 for day value of 2nd month.

What I want is just to make my application accept 13 as a month and 30 as a day for all monthes, so that i can sort my data by date. Is it possible to do so by setting culture for my application or by some other means? please help?

System.Globalization has support for many calendars of the world, but I don't know if an Ethiopian calendar is among them. You may need to define your own struct to represent a date. The following code sample is in C#, and I apologize but I do not have a moment to create a VB alternate. But perhaps you or someone else can.

static void Main(string[] args)
        {
            List<EthiopianDate> dates = new List<EthiopianDate>();
            dates.Add(new EthiopianDate(2009, 13, 4));
            dates.Add(new EthiopianDate(2005, 1, 25));
            dates.Sort();

            foreach (EthiopianDate date in dates)
                Console.WriteLine(date.ToString());

            Console.Read();
        }

        struct EthiopianDate : IComparable<EthiopianDate>
        {
            public EthiopianDate(int year, int month, int day)
            {
                this.year = year;
                this.month = month;
                this.day = day;
            }

            private readonly int year;
            private readonly int month;
            private readonly int day;

            public int Year { get { return year; } }
            public int Month { get { return month; } }
            public int Day { get { return day; } }

            public override string ToString()
            {
                string temp = this.Year.ToString()
                    + "-" + this.Month.ToString("00")
                    + "-" + this.Day.ToString("00");
                return temp;
            }

            public int CompareTo(EthiopianDate otherDate)
            {
                if (this.Year > otherDate.Year)
                    return 1;
                else if (this.Year == otherDate.Year && this.Month > otherDate.Month)
                    return 1;
                else if (this.Year == otherDate.Year && this.Month == otherDate.Month && this.Day > otherDate.Day)
                    return 1;
                else if (this.Year == otherDate.Year && this.Month == otherDate.Month && this.Day == otherDate.Day)
                    return 0;
                else
                    return -1;
            }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.