Question: Hi All
I am using DateTime class to do some processing on dates. The issue I am facing is that in some cases i would like it to initialize to date component excluding the year part of date. How do i do that?
Example: For date 11/March/2011, I only want to store 11-March. How do i do that?
Thanks

Answer: 
You can't with the DateTime class (actually a struct). You can ignore the year value in your processing, however. You could also create your own class to do what you want.
You can't to that with DateTime because it is used to represent a specific moment time.
Since a day and a month are not sufficient information to represent a date, you can't store these information in DateTime only.

Maybe you should explain further what you would like to achieve.

If your concern is about outputting/formatting this date please view the following document in MSDN for format options you can apply to the toString() method of DateTime.

[MSDN: Standard Date and Time Format Strings](http://msdn.microsoft.com/en-us/library/az4se3k1.aspx?appId=Dev10IDEF1&l=EN-US&k=k%28SYSTEM.DATETIME.GETDATETIMEFORMATS%29;k%28TargetFrameworkMoniker-%22.NETFRAMEWORK&k=VERSION=V4.0%22%29;k%28DevLang-CSHARP%29&rd=true)

Something you could do if you are really forced to use DateTime is to rebase each entered date to a specific year, although I can't see how this should make any sense, especially when it comes to leap years