<?
// specify the date
$date = "31.12.2005";
// set the input date format
$format = "DD.MM.YYYY";
// obtain the format of the current site
$new_format = CSite::GetDateFormat("SHORT"); // YYYY-MM-DD
// perform conversion
$new_date = $DB->FormatDate($date, $format, $new_format);
// got the date in the new format!
echo $new_date; // 2005-12-31
?>
<?
// convert the date from the format of one site to that of another
// obtain the format of the "de" site
$format_de = CSite::GetDateFormat("SHORT", "de"); // DD.MM.YYYY
// obtain the format of the "en" site
$format_en = CSite::GetDateFormat("SHORT", "en"); // YYYY-MM-DD
// perform conversion
$new_date = $DB->FormatDate($date, $format_de, $format_en);
// got the date in the new format!
echo $date; // 2005-12-31
?>