Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

in my program i have two datetimepickers.one for todate and another fromdate
i want fromdate as next year .can any help plz


prerana
Posted
Updated 27-Jul-11 23:16pm
v2
Comments
Manas Bhardwaj 28-Jul-11 4:28am    
what do you mean by year end? any effort btw?
Ankur\m/ 28-Jul-11 4:39am    
As Manas said, your question is not clear. use the 'Improve Question' link to update your question.

Set your DateTime picker Properties:
myDateTimePicker.Format = DateTimePickerFormat.Custom;
myDateTimePicker.CustomFormat = "yyyy";
myDateTimePicker.ShowUpDown = true;
This allows the user to select the year only (you can add text such as "End of " to the custom format if you wish)
Then:
DateTime endOfYear = new DateTime(myDateTimePicker.Value.Year, 12, 31, 23, 59, 59);
 
Share this answer
 
Try
C#
dateTimePicker1.value =  new DateTime(DateTime.Now.Year, 12, 31);
 
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