changes to remove embedded styles and use CSS instead
[openemr.git] / library / date_functions.php
blob42ef2fda2b22446fa6c7a9e30f96124452828e1b
1 <?php
2 // ============================================================
3 // dateformat
4 //
5 // return a formated string for date
6 // @args: none (it use LANGUAGE constant from globals.php)
7 // @return: $date_string (string) - formated string
8 // Cristian Navalici lemonsoftware at gmail dot com
9 //
10 // For Hebrew must be implemented a special calendar functions
11 //
12 // 10.07.2007 - dateformat accepts now an argument
13 // ============================================================
16 function dateformat ($strtime = '', $with_dow = false) {
18 // without an argument, display current date
19 if ( !$strtime ) {
20 $strtime = strtotime('now');
23 // string date is formed by
24 // $dow + date(day) + $nom + date(year) or similar
26 // name the day of the week for different languages
27 $day = date ("w", $strtime); // 0 sunday -> 6 saturday
29 switch ($day) {
30 case 0: $dow = xl ('Sunday'); break;
31 case 1: $dow = xl ('Monday'); break;
32 case 2: $dow = xl ('Tuesday'); break;
33 case 3: $dow = xl ('Wednesday'); break;
34 case 4: $dow = xl ('Thursday'); break;
35 case 5: $dow = xl ('Friday'); break;
36 case 6: $dow = xl ('Saturday'); break;
39 // $dow .=" ";
41 // name of the month in different languages
42 $month = (int) date('m', $strtime);
44 switch ($month) {
45 case 1: $nom = xl ('January'); break;
46 case 2: $nom = xl ('February'); break;
47 case 3: $nom = xl ('March'); break;
48 case 4: $nom = xl ('April'); break;
49 case 5: $nom = xl ('May'); break;
50 case 6: $nom = xl ('June'); break;
51 case 7: $nom = xl ('July'); break;
52 case 8: $nom = xl ('August'); break;
53 case 9: $nom = xl ('September'); break;
54 case 10: $nom = xl ('October'); break;
55 case 11: $nom = xl ('November'); break;
56 case 12: $nom = xl ('December'); break;
59 $nom .= " ";
61 // Date string format
62 switch (LANGUAGE) {
63 // english
64 case 1:
65 $dt = date ("F j, Y", $strtime);
66 if ($with_dow) $dt = "$dow, $dt";
67 break;
69 // swedish (sweden)
70 case 2: $dt = "$dow " . date ("Y", $strtime) . " $nom " . date("d", $strtime); break;
72 // spanish + german + dutch
73 case 3:
74 case 4:
75 case 5: $dt = "$dow " . date ("d", $strtime) . " $nom " . date("Y", $strtime); break;
77 // hebrew (israel) // display english NOT jewish calendar
78 case 6: $dt = date ("F jS Y", $strtime); break;
81 return $dt;