MCPcopy Create free account
hub / github.com/Rello/analytics / convertGermanDateFormat

Method convertGermanDateFormat

lib/Service/StorageService.php:254–267  ·  view source on GitHub ↗
($val)

Source from the content-addressed store, hash-verified

252 }
253
254 private function convertGermanDateFormat($val) {
255 if ($val !== null) {
256 $fullString = explode(' ', $val);
257 $dateLength = strlen($fullString[0]);
258 $dateParts = explode('.', $fullString[0]);
259
260 if ($dateLength >= 6 && $dateLength <= 10 && count($dateParts) === 3) {
261 // is most likely a german date format 20.02.2020
262 $fullString[0] = $dateParts[2] . '-' . sprintf('%02d', $dateParts[1]) . '-' . sprintf('%02d', $dateParts[0]);
263 $val = implode(' ', $fullString);
264 }
265 }
266 return $val;
267 }
268}

Callers 1

updateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected