help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



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

FormatDateTime

Return a string representation of a TDateTime value with a given format.

Declaration

Source position: datih.inc line 123

function FormatDateTime(

  FormatStr: String;

  DateTime: TDateTime

):String;

Description

FormatDateTime formats the date and time encoded in DateTime according to the formatting given in FormatStr. The complete list of formatting characters can be found in formatchars.

Errors

On error (such as an invalid character in the formatting string), and EConvertError exception is raised.

See also

DateTimeToStr

  

Converts a TDateTime value to a string using a predefined format.

DateToStr

  

Converts a TDateTime value to a date string with a predefined format.

TimeToStr

  

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

StrToDateTime

  

Convert a date/time string to a TDateTime value.

Example

Program Example14;

{ This program demonstrates the FormatDateTime function }

Uses sysutils;

Var ThisMoment : TDateTime;

Begin
  ThisMoment:=Now;
  Writeln ('Now : ',FormatDateTime('hh:nn',ThisMoment));
  Writeln ('Now : ',FormatDateTime('DD MM YYYY',ThisMoment));
  Writeln ('Now : ',FormatDateTime('c',ThisMoment));
End.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505