/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/php/php-507-131-012/main.php
25 строк
653 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
<?php /** * Конвертер форматов дат * Использование: php date_converter.php <дата> <формат_ввода> <формат_вывода> */ $dateString = $argv[1] ?? ''; $inputFormat = $argv[2] ?? 'Y-m-d'; $outputFormat = $argv[3] ?? 'd.m.Y'; if (empty($dateString)) { die("Укажите дату\n"); } $timestamp = strtotime($dateString); if ($timestamp === false) { die("Ошибка: Невалидный формат даты\n"); } $formattedDate = date($outputFormat, $timestamp); echo "Ввод: {$dateString} ({$inputFormat})\n"; echo "Вывод: {$formattedDate} ({$outputFormat})\n"; ?>