ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
date.php
Go to the documentation of this file.
1 <html>
2 <head>
3 <script type="text/javascript" src="../../../build/yahoo/yahoo-min.js" ></script>
4 <script type="text/javascript" src="../../../build/event/event-min.js" ></script>
5 <script type="text/javascript" src="../../../build/datasource/datasource.js" ></script>
6 <script type="text/javascript">
7 YAHOO.util.DateLocale['fr'] = YAHOO.lang.merge(YAHOO.util.DateLocale, {
8  a: ['dim', 'lun', 'mar', 'mer', 'jeu', 'ven', 'sam'],
9  A: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
10  b: ['jan', 'fév', 'mar', 'avr', 'mai', 'jun', 'jui', 'aoû', 'sep', 'oct', 'nov', 'déc'],
11  B: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
12  p: ['', ''],
13  P: ['', ''],
14  x: '%d.%m.%Y'
15 });
16 
17 YAHOO.util.DateLocale['fr-CA'] = YAHOO.lang.merge(YAHOO.util.DateLocale['fr'], { x: '%Y-%m-%d' });
18 
19 YAHOO.util.DateLocale['fr-CH'] = YAHOO.lang.merge(YAHOO.util.DateLocale['fr'], { x: '%d. %m. %y' });
20 
21 YAHOO.util.DateLocale['de'] = YAHOO.lang.merge(YAHOO.util.DateLocale['fr'], {
22  a: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
23  A: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
24  b: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
25  B: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
26 });
27 
28 YAHOO.util.DateLocale['de-CH'] = YAHOO.lang.merge(YAHOO.util.DateLocale['de'], {
29  a: ['Son', 'Mon', 'Die', 'Mit', 'Don', 'Fre', 'Sam'],
30  x: '%Y-%m-%d'
31 });
32 
33 YAHOO.util.DateLocale['hi'] = YAHOO.lang.merge(YAHOO.util.DateLocale, {
34  "a": ["\u0930\u0935\u093f ","\u0938\u094b\u092e ","\u092e\u0902\u0917\u0932 ","\u092c\u0941\u0927 ","\u0917\u0941\u0930\u0941 ","\u0936\u0941\u0915\u094d\u0930 ","\u0936\u0928\u093f "],
35  "A": ["\u0930\u0935\u093f\u0935\u093e\u0930 ","\u0938\u094b\u092e\u0935\u093e\u0930 ","\u092e\u0902\u0917\u0932\u0935\u093e\u0930 ","\u092c\u0941\u0927\u0935\u093e\u0930 ","\u0917\u0941\u0930\u0941\u0935\u093e\u0930 ","\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930 ","\u0936\u0928\u093f\u0935\u093e\u0930 "],
36  "b": ["\u091c\u0928\u0935\u0930\u0940","\u092b\u093c\u0930\u0935\u0930\u0940","\u092e\u093e\u0930\u094d\u091a","\u0905\u092a\u094d\u0930\u0947\u0932","\u092e\u0908","\u091c\u0942\u0928","\u091c\u0941\u0932\u093e\u0908","\u0905\u0917\u0938\u094d\u0924","\u0938\u093f\u0924\u092e\u094d\u092c\u0930","\u0905\u0915\u094d\u091f\u0942\u092c\u0930","\u0928\u0935\u092e\u094d\u092c\u0930","\u0926\u093f\u0938\u092e\u094d\u092c\u0930"],
37  "B":["\u091c\u0928\u0935\u0930\u0940","\u092b\u093c\u0930\u0935\u0930\u0940","\u092e\u093e\u0930\u094d\u091a","\u0905\u092a\u094d\u0930\u0947\u0932","\u092e\u0908","\u091c\u0942\u0928","\u091c\u0941\u0932\u093e\u0908","\u0905\u0917\u0938\u094d\u0924","\u0938\u093f\u0924\u092e\u094d\u092c\u0930","\u0905\u0915\u094d\u091f\u0942\u092c\u0930","\u0928\u0935\u092e\u094d\u092c\u0930","\u0926\u093f\u0938\u092e\u094d\u092c\u0930"],
38  "c": "%A %d %B %Y %r",
39  "p": ["\u092a\u0942\u0930\u094d\u0935\u093e\u0939\u094d\u0928","\u0905\u092a\u0930\u093e\u0939\u094d\u0928"],
40  "P": ["\u092a\u0942\u0930\u094d\u0935\u093e\u0939\u094d\u0928","\u0905\u092a\u0930\u093e\u0939\u094d\u0928"],
41  "r":"%I:%M:%S %p %Z",
42  "x":"%A %d %B %Y",
43  "X":"%I:%M:%S %Z"
44 });
45 
46 YAHOO.util.DateLocale['ko-KR'] = YAHOO.lang.merge(YAHOO.util.DateLocale, {
47  "a": ["\uc77c","\uc6d4","\ud654","\uc218","\ubaa9","\uae08","\ud1a0"],
48  "A": ["\uc77c\uc694\uc77c","\uc6d4\uc694\uc77c","\ud654\uc694\uc77c","\uc218\uc694\uc77c","\ubaa9\uc694\uc77c","\uae08\uc694\uc77c","\ud1a0\uc694\uc77c"],
49  "b": [" 1\uc6d4"," 2\uc6d4"," 3\uc6d4"," 4\uc6d4"," 5\uc6d4"," 6\uc6d4"," 7\uc6d4"," 8\uc6d4"," 9\uc6d4","10\uc6d4","11\uc6d4","12\uc6d4"],
50  "B": ["1\uc6d4","2\uc6d4","3\uc6d4","4\uc6d4","5\uc6d4","6\uc6d4","7\uc6d4","8\uc6d4","9\uc6d4","10\uc6d4","11\uc6d4","12\uc6d4"],
51  "c": "%x (%a) %r",
52  "p": ["\uc624\uc804","\uc624\ud6c4"],
53  "P": ["\uc624\uc804","\uc624\ud6c4"],
54  "r": "%p %I\uc2dc %M\ubd84 %S\ucd08",
55  "x": "%Y\ub144 %m\uc6d4 %d\uc77c",
56  "X": "%H\uc2dc %M\ubd84 %S\ucd08"
57 });
58 
59 </script>
60 <style type="text/css">
61 TH, TD { font-size: 0.8em; }
62 .nomatch { background-color: #f88; #color: #fff; }
63 .match { background-color: #8f8; #color: #000; }
64 TH { text-align: left; }
65 </style>
66 </head>
67 <body>
68 <?php
69 $testdates = array(time(), strtotime('1900/01/01'), strtotime('2008/01/01'), strtotime('2008/01/01 08:00:00'), strtotime('2007/12/31 23:59:59'), strtotime('2008/02/29'), strtotime('2000/12/31'));
70 /*$testdates = array();
71 for($i=1; $i<366; $i++)
72 {
73  $testdates[] = strtotime("2008/01/$i");
74  $testdates[] = strtotime("2008/01/$i 11:59:59");
75  $testdates[] = strtotime("2008/01/$i 12:00:00");
76 }*/
77 $formats = array('a','A','b','B','c','C','d','D','e','F','g','G','h','H','I','j','k','l','m','M','n','p','P','r','R','s','S','t','T','u','U','V','w','W','x','X','y','Y','z','Z','%');
78 //$formats = array('j');
79 foreach($testdates as $date)
80 {
81 ?>
82 <script type="text/javascript">
83 var date = new Date('<?php echo strftime('%Y/%m/%d %H:%M:%S', $date); ?>');
84 </script>
85 <h2>Testing: <?php echo strftime('%Y/%m/%d %H:%M:%S', $date) ?> (
86 <script type="text/javascript">
87 document.write(YAHOO.util.Date.format(date, {format: '%Y/%m/%d %H:%M:%S'}));
88 </script>
89 )</h2>
90 <table cellspacing=0 cellpadding=4 border=1>
91 <tr> <th rowspan="2">format</th> <th colspan="2">US English</th> <th colspan="2">UK English</th> <th colspan="2">French</th> <th colspan="2">Canadian French</th> <th colspan="2">Swiss French</th> <th colspan="2">German</th> <th colspan="2">Swiss German</th> <th colspan="2">Hindi</th> <th colspan="2">Hangul</th> </tr>
92 <tr> <th>PHP</th> <th>Javascript</th> <th>PHP</th> <th>Javascript</th> <th>PHP</th> <th>Javascript</th> <th>PHP</th> <th>Javascript</th> <th>PHP</th> <th>Javascript</th> <th>PHP</th> <th>Javascript</th> <th>PHP</th> <th>Javascript</th> <th>PHP</th> <th>Javascript</th> <th>PHP</th> <th>Javascript</th> </tr>
93 <?php
94 foreach($formats as $format)
95 {
96  $format = "%$format";
97 
98  setlocale(LC_TIME, 'en_US.UTF-8', 'en_US');
99  $sDate = strftime($format, $date);
100  $jsDate = preg_replace('/\n/', '\n', $sDate);
101 ?>
102 <tr>
103  <td>
104  <?php echo $format; ?>
105  </td>
106 
107  <!-- en-US -->
108  <td>
109  <?php echo $sDate ?>
110  </td>
111  <script type="text/javascript">
112  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "en-US");
113  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
114  document.write(sDate);
115  document.write("</td>\n");
116  </script>
117 
118  <!-- en-GB -->
119 <?php
120  setlocale(LC_TIME, 'en_GB.UTF-8', 'en_GB');
121  $sDate = strftime($format, $date);
122  $jsDate = preg_replace('/\n/', '\n', $sDate);
123 ?>
124  <td>
125  <?php echo $sDate ?>
126  </td>
127  <script type="text/javascript">
128  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "en-GB");
129  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
130  document.write(sDate);
131  document.write("</td>\n");
132  </script>
133 
134  <!-- fr -->
135 <?php
136  setlocale(LC_TIME, 'fr_FR.UTF-8', 'fr_FR', 'fr');
137  $sDate = strftime($format, $date);
138  $jsDate = preg_replace('/\n/', '\n', $sDate);
139 ?>
140  <td>
141  <?php echo $sDate ?>
142  </td>
143  </td>
144  <script type="text/javascript">
145  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "fr");
146  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
147  document.write(sDate);
148  document.write("</td>\n");
149  </script>
150 
151  <!-- fr-CA -->
152 <?php
153  setlocale(LC_TIME, 'fr_CA.UTF-8', 'fr_CA');
154  $sDate = strftime($format, $date);
155  $jsDate = preg_replace('/\n/', '\n', $sDate);
156 ?>
157  <td>
158  <?php echo $sDate ?>
159  </td>
160  </td>
161  <script type="text/javascript">
162  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "fr-CA");
163  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
164  document.write(sDate);
165  document.write("</td>\n");
166  </script>
167 
168  <!-- fr-CH -->
169 <?php
170  setlocale(LC_TIME, 'fr_CH.UTF-8', 'fr_CH');
171  $sDate = strftime($format, $date);
172  $jsDate = preg_replace('/\n/', '\n', $sDate);
173 ?>
174  <td>
175  <?php echo $sDate ?>
176  </td>
177  </td>
178  <script type="text/javascript">
179  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "fr-CH");
180  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
181  document.write(sDate);
182  document.write("</td>\n");
183  </script>
184 
185  <!-- de -->
186 <?php
187  setlocale(LC_TIME, 'de_DE.UTF-8', 'de_DE', 'de');
188  $sDate = strftime($format, $date);
189  $jsDate = preg_replace('/\n/', '\n', $sDate);
190 ?>
191  <td>
192  <?php echo $sDate ?>
193  </td>
194  </td>
195  <script type="text/javascript">
196  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "de-DE");
197  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
198  document.write(sDate);
199  document.write("</td>\n");
200  </script>
201 
202  <!-- de-CH -->
203 <?php
204  setlocale(LC_TIME, 'de_CH.UTF-8', 'de_CH');
205  $sDate = strftime($format, $date);
206  $jsDate = preg_replace('/\n/', '\n', $sDate);
207 ?>
208  <td>
209  <?php echo $sDate ?>
210  </td>
211  </td>
212  <script type="text/javascript">
213  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "de-CH");
214  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
215  document.write(sDate);
216  document.write("</td>\n");
217  </script>
218 
219  <!-- hi -->
220 <?php
221  setlocale(LC_TIME, 'hi_IN.UTF-8', 'hi_IN');
222  $sDate = strftime($format, $date);
223  $jsDate = preg_replace('/\n/', '\n', $sDate);
224 ?>
225  <td>
226  <?php echo $sDate ?>
227  </td>
228  </td>
229  <script type="text/javascript">
230  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "hi-IN");
231  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
232  document.write(sDate);
233  document.write("</td>\n");
234  </script>
235 
236  <!-- ko_KR -->
237 <?php
238  setlocale(LC_TIME, 'ko_KR.UTF-8', 'ko_KR');
239  $sDate = strftime($format, $date);
240  $jsDate = preg_replace('/\n/', '\n', $sDate);
241 ?>
242  <td>
243  <?php echo $sDate ?>
244  </td>
245  </td>
246  <script type="text/javascript">
247  var sDate=YAHOO.util.Date.format(date, {format: "<?php echo $format ?>"}, "ko-KR");
248  document.write("<td class='" + (sDate == "<?php echo $jsDate ?>"?"match":"nomatch") + "'>");
249  document.write(sDate);
250  document.write("</td>\n");
251  </script>
252 
253 </tr>
254 <?php
255 }
256 
257 ?>
258 </table>
259 <?php
260 }
261 ?>
262 </body>
263 </html>
264 <?php
265 
266 setlocale(LC_TIME, 'ko_KR.UTF-8', 'ko_KR');
267 $lc = array (
268  "a" => array(),
269  "A" => array(),
270  "b" => array(),
271  "B" => array(),
272  "c" => "%Y %m %d (%a) %r",
273  "p" => array(),
274  "P" => array(),
275  "r" => "%p %I %M %S %p %Z",
276  "x" => "%Y %m %d",
277  "X" => "%H %M %S"
278 );
279 $lc['c'] = strftime("%c");
280 $lc['r'] = strftime("%r");
281 $lc['x'] = strftime("%X");
282 $lc['X'] = strftime("%X");
283 for($i=6; $i<13; $i++)
284 {
285  $d = strtotime("2008/01/$i");
286  $lc['a'][] = strftime("%a", $d);
287  $lc['A'][] = strftime("%A", $d);
288 }
289 for($i=1; $i<13; $i++)
290 {
291  $d = strtotime("2008/$i/1");
292  $lc['b'][] = strftime("%b", $d);
293  $lc['B'][] = strftime("%B", $d);
294 }
295 
296 $d = strtotime("2008/01/01 10:00:00");
297 $lc['p'][] = strftime("%p", $d);
298 $lc['P'][] = strftime("%p", $d);
299 $d = strtotime("2008/01/01 22:00:00");
300 $lc['p'][] = strftime("%p", $d);
301 $lc['P'][] = strftime("%p", $d);
302 
303 echo "<!-- " . json_encode($lc) . " -->";
304 ?>
305 
306 
$testdates
Definition: date.php:69
$format
Definition: metadata.php:141
if(PHP_SAPI !='cli') color
Definition: langcheck.php:120
margin left
Definition: langcheck.php:164
"color:#CC0000 style
Definition: example_001.php:92
font size
Definition: langcheck.php:162
$lc
Definition: date.php:267
html()
$i
Definition: disco.tpl.php:19
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$formats
Definition: date.php:77