note 106197 added to function.date
| From: | dev5er6 at gmail dot com | Date: | Tue, 18 Oct 2011 09:37:46 +0000 |
| Subject: | note 106197 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183952@lists.php.net to get a copy of this message | ||
date_lang_ini â Format a local time/date
Description
string date_lang_ini ( string $format [, int $timestamp = time() [, int $mode [, string
$language = 'rus']]] )
Parameters
format - date format
timestamp - The optional timestamp parameter is an integer Unix timestamp
mode - Performs case folding. It can be one of MB_CASE_UPPER = 0 , MB_CASE_LOWER = 1, or
MB_CASE_TITLE = 2.
language - ini file name
Return Values
Returns a formatted date string.
<?php /* DATE_LANG_INI */
function date_lang_ini($f=false, $t=false, $m=null, $l='rus'){
if(!$f)return;
$d='';
$i='UTF-8';
$c='charset';
$t=($t&&$t>0&&is_numeric($t))?$t:time();
if( ! file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.$l.'.ini'))return;
$a=parse_ini_file(dirname(__FILE__).DIRECTORY_SEPARATOR.$l.'.ini',true);
$c=$a[$c][$c];
foreach(str_split(iconv($i,$c,$f))as$k)
$d.=(!isset($a[$k]))
?date($k)
:$a[$k][date($a[$k][0])];
if(!is_null($m))$d=mb_convert_case($d,$m,$c);
return iconv($c,$i,$d);
}
?>
- - - - - - - - - - - - - - - - - - - - -
- File rus.ini in windows-1251 encoding -
- - - - - - - - - - - - - - - - - - - - -
[charset]
charset=windows-1251
;charset=cp-1251
[Ð]
0=A
AM=ÐÐ
PM=ÐÐ
[а]
0=a
am=дп
pm=пп
[Ð]
0=N
1=ÐÑ
2=Ðн
3=ÐÑ
4=СÑ
5=ЧÑ
6=ÐÑ
7=Сб
[д]
0=D
Sun=ÐÑ
Mon=Ðн
Tue=ÐÑ
Wed=СÑ
Thu=ЧÑ
Fri=ÐÑ
Sat=Сб
[Ð]
0=l
Sunday=ÐоÑкÑеÑенÑе
Monday=ÐонеделÑник
Tuesday=ÐÑоÑник
Wednesday=СÑеда
Thursday=ЧеÑвеÑг
Friday=ÐÑÑниÑа
Saturday=СÑббоÑа
[Ф]
0=F
January=ЯнваÑÑ
February=ФевÑалÑ
March=ÐаÑÑ
April=ÐпÑелÑ
May=Ðай
June=ÐÑнÑ
July=ÐÑлÑ
August=ÐвгÑÑÑ
September=СенÑÑбÑÑ
October=ÐкÑÑбÑÑ
November=ÐоÑбÑÑ
December=ÐекабÑÑ
[Ñ]
0=F
January=ЯнваÑÑ
February=ФевÑалÑ
March=ÐаÑÑа
April=ÐпÑелÑ
May=ÐаÑ
June=ÐÑнÑ
July=ÐÑлÑ
August=ÐвгÑÑÑа
September=СенÑÑбÑÑ
October=ÐкÑÑбÑÑ
November=ÐоÑбÑÑ
December=ÐекабÑÑ
- - - - - - - - - - - - - - - - - - - - -
----
Server IP: 93.93.89.7
Probable Submitter: 217.119.19.86
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/106197
Del: integrated -- https://master.php.net/note/delete/106197/integrated
Del: useless -- https://master.php.net/note/delete/106197/useless
Del: bad code -- https://master.php.net/note/delete/106197/bad+code
Del: spam -- https://master.php.net/note/delete/106197/spam
Del: non-english -- https://master.php.net/note/delete/106197/non-english
Del: in docs -- https://master.php.net/note/delete/106197/in+docs
Del: other reasons-- https://master.php.net/note/delete/106197
Reject -- https://master.php.net/note/reject/106197
Search -- https://master.php.net/manage/user-notes.php