[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# TimeToStr

Convert a TDateTime time to a string using a predefined format.

## Declaration

Source position: datih.inc line 136

`function TimeToStr(`
`Time: TDateTime`
`):string; function TimeToStr(`
`Time: TDateTime;`
`const FormatSettings: TFormatSettings`
`):string;`

## Description

TimeToStr converts the time in Time to a string. It uses the LongTimeFormat variable to see what formatting needs to be applied. It is therefor entirely equivalent to a FormatDateTime('tt',Time) call.

Note that on unix systems, the localization support must be enabled explicitly, see Localization.

## Errors

None.

## Example

    Program Example25;

    { This program demonstrates the TimeToStr function }

    Uses sysutils;

    Begin
      Writeln ('The current time is : ',TimeToStr(Time));
    End.

Documentation generated on: May 14 2021