SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if i have 3 random dates.

11/12/2012 9/24/2011 12/29/2008,

I'd like to have

September 9/24/2011

November 11/12/2012

December 12/29/2008

instead of using the query to sort by years, i want it to sort by months, how would i achieve this?

share|improve this question
up vote 0 down vote accepted

I think you do not have any OOB keywords for this. Below is what you can try:

  1. Get the datatable from the list
  2. Add a new column called "MONTH" to datatable
  3. Populate this column's value for each row in datatable with something like below
    FOREACH (Datarow DR in DT.Rows)
    DR["MONTH"] = DateTime.Parse(DR["DATECOLUNM"].ToString()).ToString("MM");
  4. Then create a dataview with sort based on column "MONTH"
  5. Finally use the dataview for binding it to your control
share|improve this answer


When you try to sort the dates i believe what you are expecting can't be achieved. When sorting is applied it would do it based on the years months and dates only. Any specific reason why you need this kind of sorting ?

share|improve this answer
Check the other answer out dude, it will show you how this sort of thing is done. – Hugh Wood Nov 20 '12 at 9:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.