System.SysUtils.TimeToStr
Delphi
function TimeToStr(const DateTime: TDateTime): string;
function TimeToStr(const DateTime: TDateTime;
const AFormatSettings: TFormatSettings): string;
C++
extern DELPHI_PACKAGE System::UnicodeString __fastcall TimeToStr(const System::TDateTime DateTime)/* overload */;
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
| function | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
Description
Returns a string that represents a TDateTime value.
TimeToStr converts the Time parameter, a TDateTime value, to a string. The conversion uses the format specified by the LongTimeFormat global variable or its TFormatSettings equivalent. Change the format of the string by changing the values of some of the date and time variables.
The first form of TimeToStr is not thread-safe, because it uses localization information contained in global variables. The second form of TimeToStr, which is thread-safe, refers to localization information contained in the AFormatSettings parameter. Before calling the thread-safe form of TimeToStr, you must populate AFormatSettings with localization information. To populate AFormatSettings with a set of default locale values, call TFormatSettings.Create.