How can I get the maximum time of a DateTime value selected from datetimepicker?
For example ’08/21/2011 23:59:59′
How can I get the maximum time of a DateTime value selected from datetimepicker?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
myDateTime.AddDays(1).Date.AddSeconds(-1)Update
As per comments by @RenatoGama on the question:
One possible other answer specific to end date scenarios is
myDateTime.Date.AddDays(1). which gets you the next day to end date, use<instead of<=(as indateTocheck < endDate.Date.AddDays(1)).Sample:
Note: AFAIK, ’08/22/2011′ == ’08/22/2011 00:00:00′