DelphiBasics
TimeAMString
Variable
Determines AM value in DateTimeToString procedure SysUtils unit
var TimeAMString : string
Description
The TimeAMString variable value is used in the DateTimeToString procedure, and StrToTime function. It qualifies the hour value when the ampm formatting string is used. The position is determined by the formatting string (see the example).
 
The default value is 'AM' as set by the locale settings.
Notes
The default TimeAMString value is taken from the LOCALE_S1159 locale setting.
Related commands
DateTimeToStringRich formatting of a TDateTime variable into a string
StrToTimeConverts a time string into a TDateTime value
TimePMStringDetermines PM value in DateTimeToString procedure
TimeSeparatorThe character used to separate display time fields
 Download this web site as a Windows program.




 
Example code : Show AM as Morning
var
  myDate : TDateTime;
  formattedDate : string;

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

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

  // Format using the 'in the morning' value
  TimeAMString := 'in the morning';
  DateTimeToString(formattedDate, 'dd/mm/yyyy  @  hh:nn ampm', myDate);
  ShowMessage('With  changed AM value = '+formattedDate);
end;
Show full unit code
  Using default AM value = 09/02/2002 @ 11:03 AM
  With changed AM value = 09/02/2002 @ 11:03 in the morning
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page