SmartPascal
TimePMString
Variable
Determines PM value in DateTimeToString procedure SysUtils unit
  var TimePMString : string
Description
The TimePMString variable value is used in the DateTimeToString procedure, and the StrToTime function. It qualifies the afternoon hour value when the ampm formatting string is used. The formatting determines the position.
 
The default value is 'PM' as set by the locale settings.
Notes
The default TimePMString value is taken from the LOCALE_S2359 locale setting.
Related commands
DateTimeToString Rich formatting of a TDateTime variable into a string
StrToTime Converts a time string into a TDateTime value
TimeAMString Determines AM value in DateTimeToString procedure
TimeSeparator The character used to separate display time fields
 
Example code : Show PM as Afternoon
// 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 TimePMString 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;
  formattedDate : string;

begin
  myDate := StrToDateTime('09/02/2002 15:03');

  // Format using the default TimePMString value
  DateTimeToString(formattedDate, 'dd/mm/yyyy  @  hh:nn ampm', myDate);
  ShowMessage('Using default PM value = '+formattedDate);

  // Format using the 'in the afternoon' value
  TimePMString := 'in the afternoon';
  DateTimeToString(formattedDate, 'dd/mm/yyyy  @  hh:nn ampm', myDate);
  ShowMessage('With  changed PM value = '+formattedDate);
end;
 
end.
Hide full unit code
   Using default PM value = 09/02/2002 @ 03:03 PM
   With  changed PM value = 09/02/2002 @ 03:03 in the afternoon