Documentation

ConvertDateTime

string
ConvertDateTime(
 string datetime,
 string to_format = FORMAT_DATETIME,
 mixed from_site = false,
 bool SearchInSitesOnly = false
);

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

Function parameters

The site ID in whose format the datetime is specified.
ParameterDescription
datetime Date and time in the format of a site passed in site_id.
to_format Time format to which the date and time are to be converted. The following designations can be used when specifying the format:
  • YYYY - year
  • MM - month
  • DD - day
  • HH - hours
  • MI - minutes
  • SS - seconds
the FORMAT_DATETIME Optional parameter, the [link=6658210#format_datetime] FORMAT_DATETIME[/link], constant value is used, which stores the time format of the site (or language for the administrative section).
from_site Site ID, which format was used to specify time.
Optional parameter, the current site is used by default.
SearchInSitesOnly Optional parameter, false by default, current site.

See Also

Examples of use

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


© «Bitrix24», 2001-2024
Up