2 // ============================================================
5 // return a formated string for date
6 // @args: string (date string), boolean (include day of week)
7 // (it uses $_SESSION['language_choice'] )
8 // @return: $date_string (string) - formated string
9 // Cristian Navalici lemonsoftware at gmail dot com
11 // For Hebrew must be implemented a special calendar functions
13 // 10.07.2007 - dateformat accepts now an argument
14 // ============================================================
17 function dateformat ($strtime = '', $with_dow = false) {
19 // without an argument, display current date
21 $strtime = strtotime('now');
24 // string date is formed by
25 // $dow + date(day) + $nom + date(year) or similar
27 // name the day of the week for different languages
28 $day = date ("w", $strtime); // 0 sunday -> 6 saturday
31 case 0: $dow = xl ('Sunday'); break;
32 case 1: $dow = xl ('Monday'); break;
33 case 2: $dow = xl ('Tuesday'); break;
34 case 3: $dow = xl ('Wednesday'); break;
35 case 4: $dow = xl ('Thursday'); break;
36 case 5: $dow = xl ('Friday'); break;
37 case 6: $dow = xl ('Saturday'); break;
40 // name of the month in different languages
41 $month = (int) date('m', $strtime);
44 case 1: $nom = xl ('January'); break;
45 case 2: $nom = xl ('February'); break;
46 case 3: $nom = xl ('March'); break;
47 case 4: $nom = xl ('April'); break;
48 case 5: $nom = xl ('May'); break;
49 case 6: $nom = xl ('June'); break;
50 case 7: $nom = xl ('July'); break;
51 case 8: $nom = xl ('August'); break;
52 case 9: $nom = xl ('September'); break;
53 case 10: $nom = xl ('October'); break;
54 case 11: $nom = xl ('November'); break;
55 case 12: $nom = xl ('December'); break;
59 // First, get current language title
60 $languageTitle = getLanguageTitle($_SESSION['language_choice']);
61 switch ($languageTitle) {
62 // standard english first
63 case getLanguageTitle(1):
64 $dt = date ("F j, Y", $strtime);
65 if ($with_dow) $dt = "$dow, $dt";
68 $dt = date ("Y", $strtime) . " $nom " . date("d", $strtime);
69 if ($with_dow) $dt = "$dow $dt";
72 $dt = date ("d", $strtime) . " $nom " . date("Y", $strtime);
73 if ($with_dow) $dt = "$dow $dt";
76 $dt = date ("d", $strtime) . " $nom " . date("Y", $strtime);
77 if ($with_dow) $dt = "$dow $dt";
80 $dt = date ("d", $strtime) . " $nom " . date("Y", $strtime);
81 if ($with_dow) $dt = "$dow $dt";
83 // hebrew (israel) , display english NOT jewish calendar
85 $dt = date ("F jS Y", $strtime);
86 if ($with_dow) $dt = "$dow, $dt";
90 $dt = "$nom " . date ("d", $strtime) . ", " . date("Y", $strtime);
91 if ($with_dow) $dt = "$dow, $dt";