Click here to Skip to main content
16,021,181 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I want to display months in reports in my website (C# asp.net)
i have two dropdownlist for from month and to month


Suppose From month selected is- November 2012
Suppose To month selected is- December 2013


now i have to display in reports- November|December|January as columns
Posted
Comments
Member 8647314 12-Feb-13 6:05am    
Define more your question.

1 solution

If the variable you are storing your months is DateTime variable, then its really simple because all you have to do is convert it to string and set the parameters in the string to achieve your preferred format:

C#
//Assuming variable fromDate is DateTime variable
fromDate.toString("MM"); // returns a string with numbered month
fromDate.toString("MMMM"); // returns a string with month in words like: November
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900