summaryrefslogtreecommitdiff
path: root/protected/components/Format.php
diff options
context:
space:
mode:
authorTristan Zur <tzur@ccwn.org>2012-04-28 17:06:39 +0200
committerTristan Zur <tzur@ccwn.org>2012-04-28 17:06:39 +0200
commit139dbc9cc21fb1d419c6ecc80380f723e613efbc (patch)
tree3bfa5c3ee5c84e2ff9ec7ccef2b27f1f378a6a19 /protected/components/Format.php
parent2d4bddcbf7b816f86db6f308a4d11bc9787c1f99 (diff)
- AuditTrail Berechtigungen gesetzt (Nur Admin)
- Fehler in Extension "CJuiDateTimePicker" beseitigt - DateCompareValidator hinzugefügt - DateRangeValidator hinzugefügt - Datenbanktabellennamen geändert - Views für die Veranstaltungen bearbeitet
Diffstat (limited to 'protected/components/Format.php')
-rw-r--r--protected/components/Format.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/protected/components/Format.php b/protected/components/Format.php
index 129a292..1be259f 100644
--- a/protected/components/Format.php
+++ b/protected/components/Format.php
@@ -15,4 +15,21 @@ class Format {
public static function percentage($value) {
return Yii::app()->locale->numberFormatter->formatPercentage($value);
}
+
+ public static function dbDateTime($value) {
+ return Yii::app()->dateFormatter->format('yyyy-MM-dd HH:mm', CDateTimeParser::parse($value, 'dd.MM.yyyy HH:mm'));
+ }
+
+ public static function displayDateTime($value) {
+ $checkvalue = CDateTimeParser::parse($value, 'dd.MM.yyyy HH:mm');
+ if (!empty($checkvalue)) {
+ return $value;
+ }
+ $timestamp = CDateTimeParser::parse($value, 'yyyy-MM-dd HH:mm:ss');
+ Yii::trace('Input value: '.$value. ' -> output timestamp: '.$timestamp, 'ccwn.astaf.format');
+ if ($timestamp) {
+ return Yii::app()->dateFormatter->format('dd.MM.yyyy HH:mm', $timestamp);
+ }
+ return null;
+ }
} \ No newline at end of file