strftime

(PHP 3, PHP 4, PHP 5)

strftime -- Форматирует текущую дату/время с учетом текущей локали

Описание

string strftime ( string format [, int timestamp] )

Возвращает строку, отформатированную в соответствии с аргументом format, используя аргумент timestamp или текущее системное время, если этот аргумент не передан. Названия месяцев, дней недели и другие строки, зависящие от языка, соответствуют текущей локали, установленной функцией setlocale().

В форматирующей строке распознаются следующие символы:

  • %a - сокращенное название дня недели в текущей локали

  • %A - полное название дня недели в текущей локали

  • %b - сокращенное название месяца недели в текущей локали

  • %B - полное название месяца недели в текущей локали

  • %c - предпочтительный формат даты и времени в текущей локали

  • %C - столетие (год, деленный на 100 и огругленный до целого, от 00 до 99)

  • %d - день месяца в виде десятичного числа (от 01 до 31)

  • %D - аналогично %m/%d/%y

  • %e - день месяца в виде десятичного числа, если это одна цифра, то перед ней добавляется пробел (от ' 1' до '31')

  • %g - подобно %G, но без столетия.

  • %G - Год, 4-значное число, соответствующее номеру недели по ISO (см. %V). Аналогично %Y, за исключением того, что если номер недели по ISO соответствует предыдущему или следующему году, используется соответствующий год.

  • %h - аналогично %b

  • %H - номер часа от 00 до 23

  • %I - номер часа от 01 до 12

  • %j - номер дня в году (от 001 до 366)

  • %m - номер месяца (от 01 до 12)

  • %M - минуты

  • %n - символ "\n"

  • %p - `am' или `pm', или соответствующие строки в текущей локали

  • %r - время в формате a.m. или p.m.

  • %R - время в 24-часовом формате

  • %S - секунды

  • %t - символ табуляции ("\t")

  • %T - текущее время, аналогично %H:%M:%S

  • %u - номер дня недели от 1 до 7, где 1 соответствует понедельнику

    Внимание

    На Sun Solaris 1 соответствует воскресенью, хотя в ISO 9889:1999 (текущий стандарт языка C) явно указано, что это должен быть понедельник.

  • %U - порядковый номер недели в текущем году. Первым днем первой недели в году считается первое воскресенье года.

  • %V - Порядковый номер недели в году по стандарту ISO 8601:1988 от 01 до 53, где 1 соответствует первой неделе в году, в которой как минимум 4 дня принадлежат этому году. Первым днем недели считается понедельник. (Используйте %G or %g для определения соответствующего года)

  • %W - порядковый номер недели в текущем году. Первым днем первой недели в году считается первый понедельник года.

  • %w - номер дня недели, 0 соответствует воскресенью

  • %x - предпочтительный формат даты без времени в текущей локали

  • %X - предпочтительный формат времени без даты в текущей локали

  • %y - год без столетия (от 00 до 99)

  • %Y - год, включая столетие

  • %Z - временная зона в виде смещения, аббривеатуры или полного наименования

  • %% - символ `%'

Замечание: strftime() использует функции операционной системы, поэтому отдельные форматирующие символы могут не работать в вашей операционной системе. Кроме того, не все платформы поддерживают отрицательные метки времени support negative timestamps. Это значит, что %e, %T, %R и %D (а возможно и другие) и даты до Jan 1, 1970 не поддерживаются Windows, некоторыми версиями Linux и некоторыми другими операционными системами. Список форматирующих символов, поддерживаемых Windows, можно найти на сайте MSDN.

Пример 1. Пример использования функции strftime() с разными локалями

<?php
setlocale
(LC_TIME, "C");
echo
strftime("%A");
setlocale(LC_TIME, "fi_FI");
echo
strftime(" по-фински - %A,");
setlocale(LC_TIME, "fr_FR");
echo
strftime(" по-французски - %A и");
setlocale(LC_TIME, "de_DE");
echo
strftime(" по-немецки - %A.\n");
?>
Этот пример будет работать, если на вашей системе установлены соответствующие локали.

Замечание: %G and %V, которые основаны на номере недели по ISO 8601:1988, Могут давать результат, отличный от ожидаемого, если вы не полностью понимаете систему нумерации, используемую этим стандартом. Смотрите описание %V выше и следующий пример.

Пример 2. Пример номеров недели по ISO 8601:1988

<?php
/*      Декабрь 2002 / Январь 2003
ISO    Пн  Вт  Ср  Чт  Пт  Сб  Вс
----- ----------------------------
51    16  17  18  19  20  21  22
52    23  24  25  26  27  28  29
1      30  31  1  2  3  4  5
2      6  7  8  9  10  11  12
3      13  14  15  16  17  18  19  */

// Вывод: 12/28/2002 - %V,%G,%Y = 52,2002,2002
echo "12/28/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y", strtotime("12/28/2002")) . "\n";

// Вывод: 12/30/2002 - %V,%G,%Y = 1,2003,2002
echo "12/30/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y", strtotime("12/30/2002")) . "\n";

// Вывод: 1/3/2003 - %V,%G,%Y = 1,2003,2003
echo "1/3/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2003")) . "\n";

// Вывод: 1/10/2003 - %V,%G,%Y = 2,2003,2003
echo "1/10/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/10/2003")) . "\n";



/*      Декабрь 2004 / Январь 2005
ISO    Пн  Вт  Ср  Чт  Пт  Сб  Вс
----- ----------------------------
51    13  14  15  16  17  18  19
52    20  21  22  23  24  25  26
53    27  28  29  30  31  1  2
1      3  4  5  6  7  8  9
2      10  11  12  13  14  15  16  */

// Вывод: 12/23/2004 - %V,%G,%Y = 52,2004,2004
echo "12/23/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/23/2004")) . "\n";

// Вывод: 12/31/2004 - %V,%G,%Y = 53,2004,2004
echo "12/31/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/31/2004")) . "\n";

// Вывод: 1/2/2005 - %V,%G,%Y = 53,2004,2005
echo "1/2/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/2/2005")) . "\n";

// Вывод: 1/3/2005 - %V,%G,%Y = 1,2005,2005
echo "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n";

?>

См. также описание функций setlocale(), mktime(), и спецификацию strftime() Open Group.



strftime
phloe
16-Jul-2006 11:08
...or the really short version:

function getDaySuffix ($d) {
   $s = array("st", "nd", "rd", "th");
   return $s[min($d%10, count($s))-1];
}
brian mcallister
13-Jul-2006 06:42
In response to the function supplied by "fackelkind honorsociety de" for calculating the day suffix.

While your code is short and sweet, it doesn't actually produce the correct results. Passing 13 to the function should return "th" and not "rd". The following functions should work...

<?php
// For those of you who don't detest the Switch statement
function getDaySuffix($dayOfTheMonth) {
               switch (
$dayOfTheMonth) {
                       case 
1: return "st";
                       case 
2: return "nd";
                       case 
3: return "rd";
                       case
21: return "st";
                       case
22: return "nd";
                       case
23: return "rd";
                       case
31: return "st";
                       default: return
"th";
               }
}

// Another version for those of you who detest the Switch statement
function getDaySuffix($dayOfTheMonth) {
              
$suffix = array(
                
1 => "st",
                
2 => "nd",
                
3 => "rd",
                
21 => "st",
                
22 => "nd",
                
23 => "rd",
                
31 => "st");

               return isset(
$suffix[$dayOfTheMonth]) ? $suffix[$dayOfTheMonth] : "th";
}
?>
andy at yatescentral dot com
16-May-2006 08:47
When using strftime to generate time stamps for inclusion in  RSS feeds, be sure to use %z for the timezone (RFC-822 format) rather than %Z -- for some reason, %Z fails to validate.
posenato at sciNO dot univrSPAM dot it
14-May-2006 11:37
To partialy correct Neo's on RFC 850 date...

RFC 850 is obsolete by RFC 1036.

In HTTP header, RFC 1123 is the first choice: it has a fixed length format and 4 digits year.

Therefore, the correct format is:

gmstrftime ("%a, %d %b %Y %T %Z", time ());

Output example: Sun, 06 Nov 1994 08:49:37 GMT
Jon Keating
17-Jan-2006 05:49
Under windows if you are using Japanese version, you must use the following code:

setlocale(LC_ALL, "Japanese_Japan.20932") for EUC
setlocale(LC_ALL, "Japanese_Japan.932") for SJIS

I found the following page that helped me with this issue:
http://moodle.org/mod/forum/discuss.php?d=8329
fsc7 at yahoo dot com
28-Dec-2005 06:18
For Brazilian Portuguese language use:
setlocale(LC_ALL, 'pt_BR.iso88591');
php at REMOVEMEkennel17 dot co dot uk
19-Dec-2005 04:29
To correct an error in the above list of formatting codes:

%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale (note result is in capitals)
%P - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale (note result is in lower case)

In addition, the following codes seem to return a value on my system (Linux, Apache/1.3.33, PHP/4.4.1), but are not documented above.  I have included the result given by passing them to gmstrftime() with a timestamp of 0 (unix epoch).  gmstrftime() was used to avoid timezone/DST differences.

%F: "1970-01-01" (appears to be an SQL-formatted version of the date)
%k: "0" (seems to be the hour in 24-hour clock, without leading zeros (space-padded))
%l: "12" (seems to be the hour in 12-hour clock, without leading zeros (space-padded))
%s: "-3600"

%s seems to be the Unix timestamp passed to the function, but somehow based on the current locale/TZ settings (even in gmstrftime()). 
On my system strftime("%H:%M:%S", 0) returns "01:00:00", and strftime("%s", 0) returns "0".  Using gmstrftime() I get "00:00:00" and "-3600" respectively.
zackbloom at gmail dot com
06-Dec-2005 05:54
This function is useful for news posts.
It displays the creation date and elapsed time like:
Sunday, December 4, 2005 - 2 days ago
Monday, December 5, 2005 - Yesterday
Monday, November 28, 2005 - 1 week ago
Friday, October 28, 2005 - 6 weeks ago

function off($date){
$date = strtotime($date);
$offset = (strftime("%j")+strftime("%Y")*365)-
(strftime("%j",$date)+strftime("%Y",$date)*365);
if ($offset>7){
$offset = (strftime("%V")+strftime("%Y")*52)-
(strftime("%V",$date)+strftime("%Y",$date)*52);
$end=($offset!=0?($offset>1?$offset . " weeks ago":"a week ago"):"Today");
} else
$end=($offset!=0?($offset>1?"$offset days ago":"Yesterday"):"Today");
return strftime("%A, %B %e, %Y",$date)." - ". $end;
}

To insert the time:

<?=off("12/4/05")?>
besnikl at yahoo dot com
25-Nov-2005 12:40
Hi,

If anybody is using mambo or Joomla and strugling with the dates in Albanian Language then:

Country Locale is    sq_AL

Took me two days to figure out.

Bez
phisys at netscape dot net
16-Sep-2005 12:13
It's easy to get the current date in ISO format (YYYY-MM-DD)to insert into a date field in a database.
<? $ISOdate = strftime( "%Y-%m-%d", time() ); ?>

for other dates, better use:
<? $ISOdate = sprintf( "%04d-%02d-%02d", $year, $month, $day ); ?>
fackelkind honorsociety de
09-Aug-2005 09:01
My last post was bullshit, i gave my first version (of course the wrong one) to you.
Let me correct this:

<?php
      
function &daySufix ($dayNumber = false){

              
#> This function adds the 'st', 'nd', 'rd' or 'th' to a given daynumber. #
              
              
(string) $dayNumber    = (!$dayNumber) ? strftime ("%#d") : $dayNumber;
              
$sufixes                = Array ("1" => "st", "2" => "nd", "3" => "rd");
               return (isset (
$sufixes[substr ($dayNumber, -1)])) ? $sufixes[substr ($dayNumber, -1)] : "th";
       }
?>
fackelkind honorsociety de
08-Aug-2005 03:28
I was sure i found a script on php.net wich add the ("st", "nd", "rd", "th") behind a daynumber, but i wasn't. So i wrote a tiny function to do that:

<?php
      
function &daySufix ($dayNumber = false){
               (string)
$dayNumber    = (!$dayNumber) ? strftime ("%#d") : $dayNumber;
              
$sufixes                = Array ("1" => "st", "2" => "nd", "3" => "rd");
               return (isset (
$sufixes[$dayNumber])) ? $sufixes[$dayNumber] : "th";
       }
?>

Use it as follow:

<?php
      
echo strftime ("%A, %b. %#d" . daySufix() . " %Y");
?>
jw at jwscripts dot com
29-May-2005 06:32
The following function implements the conversion specifiers which are not supported on Win32 platforms:

(Note: the specifiers %V, %G and %g can be implemented using other functions described in this section)

<?php

function strftime_win32($format, $ts = null) {
   if (!
$ts) $ts = time();

  
$mapping = array(
      
'%C' => sprintf("%02d", date("Y", $ts) / 100),
      
'%D' => '%m/%d/%y',
      
'%e' => sprintf("%' 2d", date("j", $ts)),
      
'%h' => '%b',
      
'%n' => "\n",
      
'%r' => date("h:i:s", $ts) . " %p",
      
'%R' => date("H:i", $ts),
      
'%t' => "\t",
      
'%T' => '%H:%M:%S',
      
'%u' => ($w = date("w", $ts)) ? $w : 7
  
);
  
$format = str_replace(
      
array_keys($mapping),
      
array_values($mapping),
      
$format
  
);

   return
strftime($format, $ts);
}

?>
patrick at codeministry dot dk
20-Apr-2005 02:50
For freebsd user:

You can find the full list of your locale under /usr/share/locale.
For example da_DK.ISO8859-1 under this directory will set up the locale to danish.
bohac at smartcat dot cz
19-Mar-2005 10:36
i had to use the czech representation of time on unix machine, running debian and linux version of apache with php 4

for me the best solution was to use this code:

<php
     setlocale(LC_ALL, 'cs_CZ.iso88592');
?>

then you can do everything in czech language with correct iso-8859-2 encoding ;D
mflaig at pro-linux dot de
21-Feb-2005 03:57
Hi there,

i had the problem that I needed all days of an week with some extra infos. given is day, month, year (selectboxes).

so I hacked this together ...

function ...
<?php
function get_weekdates($year, $month, $day){
 
setlocale(LC_ALL, "C");
 
//echo "Year $year<br>";
  //echo "Month $month<br>";
  //echo "Day $day<br>";

  // make unix time
 
$searchdate = mktime(0,0,0,$month,$day,$year);
 
//echo "Searchdate: $searchdate<br>";

  // lets get the day of week                //    on solaris <8 the first day of week is sunday, not monday
 
$day_of_week = strftime("%u", $searchdate); 
 
//echo "Debug: $day_of_week <br><br>";
 
 
$days_to_firstday = ($day_of_week - 1);        //    on solaris <8 this may not work
  //echo "Debug: $days_to_firstday <br>";

 
$days_to_lastday = (7 - $day_of_week);        //    on solaris <8 this may not work
  //echo "Debug: $days_to_lastday <br>";

 
$date_firstday = strtotime("-".$days_to_firstday." days", $searchdate);
 
//echo "Debug: $date_firstday <br>";

 
$date_lastday = strtotime("+".$days_to_lastday. " days", $searchdate);
 
//echo "Debug: $date_lastday <br>";

 
$d_result = "";                    // array to return

  // write an array of all dates of this week
 
for($i=0; $i<=6; $i++) {
  
$y = $i + 1;
  
$d_date = strtotime("+".$i." days", $date_firstday);
  
  
// feel free to add more values to these hashes
  
$result[$y]['year'] = strftime("%Y", $d_date);
  
$result[$y]['month'] = strftime("%m", $d_date);
  
$result[$y]['day'] = strftime("%d", $d_date);
  
$result[$y]['dayname'] = strftime("%A", $d_date);
  
$result[$y]['shortdayname'] = strftime("%a", $d_date);
  
$result[$y]['sqldate'] = strftime("%Y-%m-%d", $d_date);
  }

  return
$result;                    // return the array
}
?>

so you can read all this by doing something like that:

<?php
  $week
= get_weekdates($year,$month,$day);

  for(
$i = 1; $i<=7 ; $i++) {

   echo
'Year: ' . $week[$i]['year'] . '<br>';
   echo
'Month: ' . $week[$i]['month'] . '<br>';
   echo
'Day: ' . $week[$i]['day'] . '<br>';
   echo
'Longname: ' . $week[$i]['dayname'] . '<br>';
   echo
'Shortname: ' . $week[$i]['shortdayname'] . '<br>';
   echo
'Sqldate: ' . $week[$i]['sqldate'] . '<br>';
   echo
'<br>';

  }
?>

I hope this helpes someone out there ...
... notes and improvements welcome (via email / pgp preferred)

Note: It does not work on Slowlaris <8 because of the %u problem (see the other posting for further details)

for Windows and solaris you may check out the posting of vesa dot kivisto at nepton dot fi ....

this code was inspired by pb at _remove_ pedal dot dk s code

Have a nice day (night || whatever),

mfl
Aaron
25-Jan-2005 01:10
%k will give you %H (hour, 24-hour clock) with the leading zero replaced by a space.  I have only tested this on one linux system so far, it may not work on windows or other linux builds.
james at oicgroup dot net
19-Nov-2004 07:27
In looking for a way to trim the leading zero from a 12 hour time format (08:30 PM for instance), we happened upon %l (lowercase L) quite by accident.  It replaces the leading zero with a space similiar to what %e does with dates, so you get 8:30 PM instead of 08:30 PM.
michiel1978 at hotmail dot com
06-Oct-2004 02:31
As said in these comments, Windows strftime() doesn't support %e. However, to achieve a similar effect (not 100%) you can use %#d. The # flag will remove the leading zero, so you do get single digits, but without the space that would be added by %e in other environments.
neo at gothic-chat d0t de
24-Jun-2004 11:27
To get a RFC 850 date (used in HTTP) of the current time:

gmstrftime ("%A %d-%b-%y %T %Z", time ());

This will get for example:
Friday 25-Jun-04 03:30:23 GMT

Please note that times in HTTP-headers _must_ be GMT, so use gmstrftime() instead of strftime().
bigfoot at spido dot dk
16-Jun-2004 06:12
The %e "bug" in strftime on Windows systems can be fixed this way...

<?

setlocale
(LC_TIME, 'da');

$var1 = strftime("%A den ");

function
strftime_e_fix(){

  
$var = strftime("%d");

   if(
$var{0} == 0){$var = $var{1};}

   return(
$var);

}

$var1 .= strftime_e_fix();

$var1 .= strftime(". %B, %Y");

echo
$var1;

?>
adan at cr72 dot com
09-Jun-2004 04:48
For Spanish:
<?
setlocale
(LC_ALL, "sp");
echo
strftime("%d. %B %Y");
?>
verhoeff
15-Apr-2004 03:54
The locale for dutch on a win2k computer is not "nl_NL"
but "dutch".
php_manual at it-rex dot nl
28-Mar-2004 05:31
In the strftime override-function of rickenmeer at hotmail dot com there is an error.

The line:
  $year = 1969;
should read:
  $year = 1970;
rolex
25-Mar-2004 08:37
Searching for translation from IBASE-Timestamp to EU-Dateformat DD.MM.YYYY

strftime("%d.%m.%Y",strtotime($row->START_TIMESTAMP));

Maybe it's useful for somebody ;-)
pb at _remove_ pedal dot dk
22-Feb-2004 07:51
Ever wanted to find the first and last dates in a given week? i.e. you have a week number and a year, what date has the first and last days in that week respectively? Below is a function that does just that. You feed it with a week/year and it returns an array with first and last day:

function mk_week_to_dates($week, $year){
       //We start some time into prev year
       $searchdate = mktime(0,0,0,12,20,$year-1);
       //Then we advance $week-1 weeks ahead (no need to search through dates we know won't give results)
       $searchdate = strtotime("+".($week-1)." week",$searchdate);

       $found=false;
       while ($found==false){
               if (date("W",$searchdate) == $week)
                       $found = true;
               else
                       $searchdate = strtotime("+1 day",$searchdate);
       }

       $weekdates['firstday'] = $searchdate;

       $weekdates['lastday'] = strtotime("+6 day",$searchdate);
       return $weekdates;
}
rickenmeer at hotmail dot com
12-Jan-2004 08:10
This override for strftime was created to cope with the date limits on Win32 (1970-2037). Current mappings and allows you to calculate daylight savings time etc. for 1902-1969, feel free to add more mappings!

<?PHP
function &strftime ($format = "", $timestamp = false)
{
   if (
$timestamp >= 0 && $timestamp <= 2147480047)
   {
// between 1 Jan 1970 00:00:00 and 19 Jan 2038 03:14:07 GMT
      
return strftime ($format, $timestamp);
   }

  
$mappings = Array (
       Array (
"start" => 1902, "end" => 1951, "map" => 1986), // 1902-1951 = 1986-2035
      
Array ("start" => 1952, "end" => 1969, "map" => 1980), // 1952-1969 = 1980-1997
  
);
  
   if (
$timestamp < 0)
   {
      
$year = 1969;
       while (
$timestamp < 0)
       {
          
$days = ($year % 4 == 0 && ($year % 100 > 0 || $year % 400 == 0)) ? 366 : 365;
          
$timestamp += $days * 86400;
          
$year--;
       }
   }
   else
// if ($timestamp > 2147480047)
  
{
      
$year = 2038;
       while (
$timestamp > 0)
       {
          
$days = ($year % 4 == 0 && ($year % 100 > 0 || $year % 400 == 0)) ? 366 : 365;
          
$timestamp -= $days * 86400;
          
$year++;
       }
   }

   foreach (
$mappings as $mapping)
       if (
$year >= $mapping["start"] && $year <= $mapping["end"])
       {
          
$find = Array ("%y", "%Y", "%D");
          
$replace = Array (substr ($year, -2), $year, "%m/%d/" . substr ($year, -2));
          
$format =& str_replace ($find, $replace, $format);
          
$map_from_1970 = mktime (0, 0, 0, 1, 1, $mapping["map"]);
           return
strftime ($format, $timestamp + $map_from_1970);
       }
  
   return
"strftime (): Year not mapped yet: " . $year;
}
?>
shaun at nospam dot phplabs dot com
14-Mar-2003 04:03
I recently needed a way to find the first second of the current week. The catch was that strftime("%u") considers Monday as the first day of the week, whereas I needed things based on Sundays.

My solution was to determine how many days had elapsed since the previous Sunday (0 if today is a Sunday), and subtract that may days from the current day's midnight timestamp:

$weekstart = mktime(0, 0, 0, date("m"), date("d"), date("Y")) - ((strftime("%u") == 7) ? 0 : (86400 * strftime("%u")));

This will assign the epoch stamp of the most recent Sunday at 00:00 (today at 00:00, if today is a Sunday) to $weekstart.
pb at pedal dot dk
21-Dec-2002 08:37
I am truly sorry - I contributed with a script to overcome the missing %V for Windows-users. It contained a serious flaw, that prohibited in some cases. Below is a script, that should work in all cases. I have tested it on most outer cases, e.g. 2005/12/31 and 2006/01/01.

function ISOWeek($y, $m, $d)
{
$week=strftime("%W", mktime(0, 0, 0, $m, $d, $y));
$dow0101=getdate(mktime(0, 0, 0, 1, 1, $y));
$next0101=getdate(mktime(0, 0, 0, 1, 1, $y+1));

 if ($dow0101["wday"]>1 &&
   $dow0101["wday"]<5)
   $week++;
 if ($next0101["wday"]>1 &&
   $next0101["wday"]<5 &&
     $week==53)
   $week=1;
 if ($week==0)
   $week = ISOWeek($y-1,12,31);

 return(substr("00" . $week, -2));
}

Regards
vminarik at ips-ag dot cz
10-Sep-2001 06:02
Note that setting LC_TIME is not enough for some locales under Windows, e.g. Czech, because there are some characters not contained in default (US) character set like '' (c with hook), '' (r with hook).


If you run Apache as regular application and have set your locale to Czech (ControlPanel/RegionalOptions), there is no problem and 'September' is correctly translated as 'z', 'Thursday' as 'tvrtek'.
But if you run Apache as service, you get 'zr', and 'ctvrtek'.
To get things work as you expect you must set LC_CTYPE beside LC_TIME, or set LC_ALL.

<?
  $locale
= 'Czech_Czech.1250';
 
$res = setlocale( 'LC_CTYPE', $locale); //important
 
$res = setlocale( 'LC_TIME', $locale);
  echo
strftime( '%A %m. %B %Y', mktime( 0,0,0,9,6,2001));
?>
verdy_p at wanadoo dot fr
22-Jul-2001 05:33
Beware of '%D':
the comment shown expects that this is the same as '%m/%d/%y'.

This is wrong: '%D' is only expected to returned an abbreviated numeric date according to the current locale:
In the German locale '%D' is '%y.%m.%d'
In the French locale '%D' is '%d/%m/%y'

The locale rules still apply to %D as with '%A'...

Beware that some C libraries do not support '%D' and/or '%A'  or do not support them accordingly. Using strftime() is then system-dependant, because PHP use the C function provided by the system on which it runs.
spamyenot at example dot com
18-Jul-2001 11:09
Solaris 2.6 and 7 define the
%u specifier differently than noted here. Day 1 is Sunday, not Monday. Solaris 8 gets it right.

Jim
zmajeed at cup dot hp dot com
22-Jul-1999 03:14
Locale names are OS dependent. HP-UX 11.0, for example, has three
German locales, de_DE.roman8, de_DE.iso88591, and
de_DE.iso885915@euro.
The command locale -a will display all available locales on a system.

So on HP-UX, to get German dates:
setlocale("LC_TIME", "de_DE.roman8");
print(strftime("%A\n"));

<mktimestrptime>
 Last updated: Tue, 15 Nov 2005