Purpose


Allows you to set your own date or time format.



Description


For example, to make the date look like: Monday, 7 December 20, use the following format: dddd, d MMMM yy



The following format characters are understood:
yy = The last two digits of the year (that is, 2020 would be displayed as "20").  
yyyy = The full year (that is, 2020 would be displayed as "2020").  
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 (Jan).  
MMMM = The full month name. (January)
d = The one- or two-digit day.
dd = The two-digit day. Single-digit day values are preceded by a zero.
ddd = The three-character weekday abbreviation.
dddd = The full weekday name.

h = The one- or two-digit hour in 12-hour format.
hh = The two-digit hour in 12-hour format. Single-digit values are preceded by a zero.
H = The one- or two-digit hour in 24-hour format.
HH = The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.
m = The one- or two-digit minute.
mm = The two-digit minute. Single-digit values are preceded by a zero.
t = The one-letter AM/PM abbreviation (that is, AM is displayed as "A").
tt = The two-letter AM/PM abbreviation (that is, AM is displayed as "AM").



If the DateTimePicker component has the property Kind = DateTime, you can change the time format using the script:


procedure Form1_OnShow (Sender: TObject; Action: string);
begin
  Form1.DateTimePicker1.TimeFormat := 'HH:mm';
end;