Dear all,
When I set the Format property of UltraCalendarCombo object to "MM/dd", it always return the year of DateTime value is current Year.
Example: I select 2010/11/11, and it will return the Value is 2011/11/11 (current year is 2011)
Please help me resolve this problem.
Thank you.
Hello,
I am just checking about the progress of this issue. Please let me know If you need my further assistance on this.
That is correct behavior because with formats like those, the "DateTime" struct’s Parse method is going to use the current year when none is specified (as in the ‘MM/dd’ case), and default to month 1 day 1 (as in the ‘yyyy’ case).
The 'UltraDateTimeEditor' control might suit your needs in this case. It has a 'FormatInfo' property along with 'MaskInput'. If you set the format to "MM/dd" the 'Value' will return the year from which the month and day have been selected.
Please do not hesitate to contact us if you need any additional assistance.
Thank you for your reply.
I know the difference between 'Text' and 'Value' property.
My problem: 'Value' property returns the DateTime object, but it returns DateTime value which year always is current year, although you select other year on the date time picker. So the return value contains incorrect year, day and month are correct. It's only incorrect when 'Format' property doesn't contain year, e.g "MM/dd"
I believe that the 'Format' property of this control specifies the displaying string of the 'Text' property. What you could do is getting this 'Text' property or either convert to 'Value' property to 'DateTime' type and get it's day and month.
Please feel free to let me know if I misunderstood you or if you have any other questions.