Search code examples
delphitdatetimepicker

TDatetimePicker format shows wrongly


If i set the property "format" of a TDateTimePicker component (Delphi XE10) eg. ddd d/m/yyyy then it shows Tue 14/47/2016 !! and the date 31/12/2016 as 31/0/2016 ! what is happening, please ?


Solution

  • That date format is incorrect. You need to use uppercase M, as is shown in the TDateTimePicker.Format documentation. Lower-case m represents minutes in a time format.

    m    The one- or two-digit minute.
    mm   The two-digit minute. Single-digit values are preceded by a zero.
    M    The one- or two-digit month number.
    MM   The two-digit month number. Single-digit values are preceded by a zero.
    MMM  The three-character month abbreviation.
    MMMM The full month name. 
    

    ddd MM/dd/yyyy shows Tue 06/14/2016, and ddd dd/MM/yyyy shows Tue 14/06/2016.