Bitrix Site Manager

ConvertDateTime

string
ConvertDateTime(
 string datetime,
 string format = FORMAT_DATETIME,
 mixed site_id = false
)

The function ConvertDateTime takes the date and time specified in the format of the current site and converts it to an arbitrary format.

Parameters

ParameterDescription
datetime Date and time in the format of a site passed in site_id.
format Specifies the format to which the date and time are to be converted. The following specifies are possible:
  • YYYY - year;
  • MM - month;
  • DD - day;
  • HH - hours;
  • MI - minutes;
  • SS - seconds.
Optional. By default, the FORMAT_DATETIME constant value is used, which stores the time format of the site (or language for the administrative section).
site_id The site ID in whose format the datetime is specified.
Optional. The current site is used by default.

See Also

Example



<?
echo ConvertDateTime("25.12.2003", "YYYY-MM-DD", "ru"); // 2003-12-25
?>