Long version of the date to string format SysUtils unit
  var LongDateFormat : string;
The LongDateFormat variable provides the long (extended) formatting used for certain date to string conversions.
It is used by the DateTimeToString routine when the 'dddddd' formatting is used. The following formatting character strings can be used in the LongDateFormat 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_SLONGDATE
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
ShortDateFormat Compact version of the date to string format
 Author links

 Buy Website Traffic at

 Buy Proxies at
 Download this web site as a Windows program.

Example code : Illustrating customised LongDateFormat 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;
  SysUtils,   // Unit containing the LongDateFormat command
  Forms, Dialogs;
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
Form1: TForm1;
{$R *.dfm} // Include form definitions
procedure TForm1.FormCreate(Sender: TObject);

  myDate : TDateTime;
  formattedDate : string;

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

  // Display using the default LongDateFormat
  DateTimeToString(formattedDate, 'dddddd', myDate);
  ShowMessage('29/02/2000 using  default = '+formattedDate);

  // Change the display formatting
  LongDateFormat := 'dddd dd of mmmm yyyy';
  DateTimeToString(formattedDate, 'dddddd', myDate);
  ShowMessage('29/02/2000 using override = '+formattedDate);
Hide full unit code
   29/02/2000 using  default = 29 February 2000
   29/02/2000 using override = Tuesday 29 of February 2000
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page