Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
DateTime.php
Go to the documentation of this file.
1<?php
2
4
8
19
20 public static function transform($value) {
21 if ($value != null)
22 return new \DateTime ( $value );
23 }
24
25 public static function reverse($value) {
26 if ($value instanceof \DateTime) {
27 return $value->format ( 'Y-m-d H:i:s' );
28 }
29 return $value;
30 }
31
32 public static function toView($value) {
33 return self::reverse ( $value );
34 }
35
36 public static function toForm($value) {
37 if ($value instanceof \DateTime)
38 return $value->format ( 'Y-m-d\TH:i:s' );
39 return date ( 'Y-m-d\TH:i:s', strtotime ( $value ) );
40 }
41}
Transform a mysql date to a php DateTime.
Definition DateTime.php:18
static toView($value)
Transforms normalized data to view data.
Definition DateTime.php:32
static transform($value)
Transforms model data to normalized data.
Definition DateTime.php:20
static toForm($value)
Transforms normalized data to form data.
Definition DateTime.php:36
static reverse($value)
Reverse data transforming to model data.
Definition DateTime.php:25
Transform an instance for being displayed in a view.