Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
/*
setlocale(LC_TIME, "en_US");
echo strftime('%F', time());
echo date('Y-m-d', time());
*/
function strf_time($format, $timestamp, $locale) {
// $date_str = strftime($format, $timestamp);
$date_str = date($format, $timestamp);
if (strpos($locale, '1251') !== false) {
return iconv('cp1251', 'utf-8', $date_str);
} else {
return $date_str;
}
}
echo strf_time("Y-M", strtotime('2025-01-20 17:12:42'), setlocale(LC_TIME, 'ru_RU.UTF-8', 'Rus'));