SmartPascal
ShortDateFormat
Variable
Compact version of the date to string format SysUtils unit
  var ShortDateFormat : string;
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:
 
= 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)
Notes
The default value is set from LOCALE_SSHORTDATE
Related commands
DateTimeToStr Converts TDateTime date and time values to a string
DateTimeToString Rich formatting of a TDateTime variable into a string
DateToStr Converts a TDateTime date value to a string
FormatDateTime Rich formatting of a TDateTime variable into a string
LongDateFormat Long version of the date to string format
 
Example code : Illustrating customised ShortDateFormat setting
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  SysUtils,   // Unit containing the ShortDateFormat command
  DateUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  myDate : TDateTime;

begin
  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));
end;
 
end.
Hide full unit code
   29/02/2000 using default = 29/02/2000
   29/02/2000 using dddd dd mmmm yyyy = Tuesday 29 February 2000