DelphiBasics
DateSeparator
Variable
The character used to separate display date fields SysUtils unit
  var DateSeparator : char;
Description
The DateSeparator variable is used in date and time display functions.
 
DateSeparator value is '/' by default, depending on the Windows locale.
Notes
DateSeparator = LOCALE_SDATE by default.
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
TimeAMString Determines AM value in DateTimeToString procedure
TimePMString Determines PM value in DateTimeToString procedure
TimeSeparator The character used to separate display time fields
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

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




 
Example code : Changing the date display separator character
// 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 DateSeparator 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 := EndOfAMonth(2000, 2); // 29th Feb 2000 at 23:59:59.999

  ShowMessage('Date     = '+DateTimeToStr(myDate));
  DateSeparator := '_';           // Override the / date separator
  ShowMessage('Date now = '+DateTimeToStr(myDate));
end;
 
end.
Hide full unit code
   Date     = 29/02/2000 23:59:59
   Date now = 29_02_2000 23:59:59
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page