set a date to yesterday

3 posts, 0 answers
  1. Smiely
    Smiely avatar
    129 posts
    Member since:
    Nov 2010

    Posted 25 Jan 2011 Link to this post

    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. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 25 Jan 2011 Link to this post

    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.
  3. Smiely
    Smiely avatar
    129 posts
    Member since:
    Nov 2010

    Posted 25 Jan 2011 Link to this post

    IT WORKED !!!!! Thanks Cori!!!!
Back to Top