Description |
The ShortDateFormat variable provides the short (compact) formatting used for default date to string conversion.
It is used by the DateToStr, DateTimeToStr and DateTimeToString routines (the latter when the 'c' or 'ddddd' formatting is used).
The following formatting character strings can be used in the ShortDateFormat string:
y | = Year last 2 digits |
yy | = Year last 2 digits |
yyyy | = Year as 4 digits |
m | = Month number no-leading 0 |
mm | = Month number as 2 digits |
mmm | = Month using ShortDayNames (Jan) |
mmmm | = Month using LongDayNames (January) |
d | = Day number no-leading 0 |
dd | = Day number as 2 digits |
ddd | = Day using ShortDayNames (Sun) |
dddd | = Day using LongDayNames (Sunday) |
|
|
Notes |
The default value is set from LOCALE_SSHORTDATE
|
|
Related commands |
|
|
|
Example code : Illustrating customised ShortDateFormat setting |
var
myDate : TDateTime;
begin
myDate := StrToDate('29/02/2000');
// Display using the default ShortDateFormat
WriteLn('29/02/2000 using default = '+DateToStr(myDate));
// Change the display formatting
ShortDateFormat := 'dddd dd mmmm yyyy';
WriteLn('29/02/2000 using dddd dd mmmm yyyy = '+DateToStr(myDate));
end;
|
Show full unit code |
29/02/2000 using default = 29/02/2000
29/02/2000 using dddd dd mmmm yyyy = Tuesday 29 February 2000
|
|