Compact version of the date to string format SysUtils unit
var ShortDateFormat : string;
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:
= Year last 2 digits
yy  = Year last 2 digits
yyyy  = Year as 4 digits
= Month number no-leading 0
mm  = Month number as 2 digits
mmm  = Month using ShortDayNames (Jan)
mmmm  = Month using LongDayNames  (January)
= Day number no-leading 0
dd  = Day number as 2 digits
ddd  = Day using ShortDayNames (Sun)
dddd  = Day using LongDayNames  (Sunday)
The default value is set from LOCALE_SSHORTDATE
Related commands
DateTimeToStrConverts TDateTime date and time values to a string
DateTimeToStringRich formatting of a TDateTime variable into a string
DateToStrConverts a TDateTime date value to a string
FormatDateTimeRich formatting of a TDateTime variable into a string
LongDateFormatLong version of the date to string format
 Download this web site as a Windows program.

Example code : Illustrating customised ShortDateFormat setting
  myDate : TDateTime;

  myDate := StrToDate('29/02/2000');

  // Display using the default ShortDateFormat
  ShowMessage('29/02/2000 using default = '+DateToStr(myDate));

  // Change the display formatting
  ShortDateFormat := 'dddd dd mmmm yyyy';
  ShowMessage('29/02/2000 using dddd dd mmmm yyyy = '+DateToStr(myDate));
Show full unit code
  29/02/2000 using default = 29/02/2000
  29/02/2000 using dddd dd mmmm yyyy = Tuesday 29 February 2000
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page