This is a migrated thread and some comments may be shown as answers.

set a date to yesterday

2 Answers 71 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Smiely
Top achievements
Rank 1
Smiely asked on 25 Jan 2011, 05:48 PM

fromRadDateTimePicker.SelectedDate =

DateTime.Today;

 

toRadDateTimePicker.SelectedDate =

DateTime.Today;

 


How do I change fromRadDateTimePicker to set yesterdays date ?
Also how do I set time to 12:01AM ?

Please help thanks

2 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 25 Jan 2011, 06:58 PM
Hello Smiely,

You would set it like so:

fromRadDateTimePicker.SelectedDate = DateTime.Today.AddDays(-1);

To set the the time to 12:01AM, you would do something like this:

fromRadDateTimePicker.SelectedDate = new DateTime(DateTime.Today.Year,DateTime.Today.Month,DateTime.Today.Day, 12, 1, 0);

I hope that helps.
0
Smiely
Top achievements
Rank 1
answered on 25 Jan 2011, 07:51 PM
IT WORKED !!!!! Thanks Cori!!!!
Tags
Calendar
Asked by
Smiely
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Smiely
Top achievements
Rank 1
Share this question
or