19 require_once(BASE.
"wcmf/lib/util/class.Message.php");
20 require_once(BASE.
"wcmf/lib/persistence/converter/class.DataConverter.php");
37 $type = strtolower($type);
38 if ($data !=
'' && ($type ==
'datetime' || $type ==
'date'))
40 global $MESSAGE_LANGUAGE;
41 $locale = strtolower($MESSAGE_LANGUAGE);
44 if (strpos($data,
"0000-00-00") === 0)
49 $convertFunction =
"storageTo_".$locale;
50 $methods = get_class_methods($this);
51 if (in_array($convertFunction, $methods))
52 $data = $this->$convertFunction($data, $type);
67 global $MESSAGE_LANGUAGE;
68 $locale = strtolower($MESSAGE_LANGUAGE);
69 $type = strtolower($type);
71 if ($type ==
'datetime' || $type ==
'date')
74 $convertFunction = $locale.
"ToEnglish";
75 $methods = get_class_methods($this);
76 if (in_array($convertFunction, $methods))
77 $date = $this->$convertFunction($data, $type);
80 if ($type ==
'datetime')
81 $data = strftime(
"%Y-%m-%d %H:%M:%S", strtotime($date));
83 $data = strftime(
"%Y-%m-%d", strtotime($date));
96 $testFormat = preg_split(
"/[\.: ]/", $date);
97 if (
sizeof($testFormat) != 6 &&
sizeof($testFormat) != 5 &&
sizeof($testFormat) != 3)
100 list($d, $m, $Y, $H, $M, $S) = preg_split(
"/[\.: ]/", $date);
101 if ($type ==
'datetime')
104 if ($H==
"") $H =
"00";
105 if ($M==
"") $M =
"00";
106 if ($S==
"") $S =
"00";
107 return $m.
"/".$d.
"/".$Y.
" ".$H.
":".$M.
":".$S;
109 elseif ($type ==
'date')
110 return $m.
"/".$d.
"/".$Y;
130 if ($type ==
'datetime')
131 return strftime(
"%d.%m.%Y %H:%M:%S", strtotime($date));
132 elseif ($type ==
'date')
133 return strftime(
"%d.%m.%Y", strtotime($date));
144 if ($type ==
'datetime')
145 return strftime(
"%m/%d/%Y %H:%M:%S", strtotime($date));
146 elseif ($type ==
'date')
147 return strftime(
"%m/%d/%Y", strtotime($date));
storageTo_de_de($date, $type)
storageTo_en_en($date, $type)
convertApplicationToStorage($data, $type, $name)
MySQLDateConverter converts MySQL dates to a date localized to the users or application settings...
de_deToEnglish($date, $type)
convertStorageToApplication($data, $type, $name)
DataConverter is the base class for all converter classes. It defines the interface for converting da...
en_enToEnglish($date, $type)