Documentation

formatDate

string public
\Bitrix\Main\DB\MssqlSqlHelper::formatDate(
 string $format,
 string $field = null
);
for converting

This non-static method returns database expression to convert $field value according the $format..

Following format parts converted:

  • YYYY - A full numeric representation of a year, 4 digits.
  • MMMM - A full textual representation of a month, such as January or March.
  • MM - Numeric representation of a month, with leading zeros.
  • MI - Minutes with leading zeros.
  • M - A short textual representation of a month, three letters.
  • DD - Day of the month, 2 digits with leading zeros.
  • HH - 24-hour format of an hour with leading zeros.
  • H - 24-hour format of an hour without leading zeros.
  • GG - 12-hour format of an hour with leading zeros.
  • G - 12-hour format of an hour without leading zeros.
  • SS - Seconds with leading zeros.
  • TT - AM or PM
  • T - AM or PM.

$field parameter is SQL unsafe..

Parameters

ParameterDescriptionVersion
$formatFormat.
$fieldDatabase field or expression.

Examples



© «Bitrix24», 2001-2024
Up