Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
UltraDateTimeEditor - default values
posted

I have 2 UltraDateTimeEditors on my form.  I want the first one to automatically default to the first of the month and the second one to default to the last day of the month.  How do I do this?

  • 37774
    Verified Answer
    posted

    You could do something like:

    int year = DateTime.Now.Year;
    int month = DateTime.Now.Month;
    this.ultraDateTimeEditor1.Value = new DateTime(year, month, 1);
    this.ultraDateTimeEditor2.Value = new DateTime(year, month, DateTime.DaysInMonth(year, month));

    -Matt