Fakoli Framework
TimestampTypeRenderer Class Reference
+ Inheritance diagram for TimestampTypeRenderer:
+ Collaboration diagram for TimestampTypeRenderer:

Public Member Functions

 TimestampTypeRenderer ()
 
- Public Member Functions inherited from AbstractTypeRenderer
 AbstractTypeRenderer ()
 

Static Public Member Functions

static format ($timestamp, $template="")
 
- Static Public Member Functions inherited from AbstractTypeRenderer
static format ($value, $template="")
 
static translationDateTemplate ($template, $includeTime=true)
 

Detailed Description

Definition at line 37 of file timestamp_type_renderer.inc.

Member Function Documentation

◆ format()

static TimestampTypeRenderer::format (   $timestamp,
  $template = "" 
)
static

Definition at line 61 of file timestamp_type_renderer.inc.

62  {
63  trace("TimestampTypeRenderer template is $template and value is $timestamp", 5);
64 
65  $text = "";
66 
67  if (!$timestamp) return "N/A";
68 
69  // This default is needed for XML transation but is not
70  // a user-readable format.
71  elseif($timestamp && !$template)
72  $template = "Y-m-d H:i:s";
73 
74  $template = AbstractTypeRenderer::translationDateTemplate($template);
75 
76  if($timestamp)
77  {
78  $dateObj = new DateTime($timestamp);
79  $text = $dateObj->format($template);
80 
81  }
82  return $text;
83  /*
84  if (preg_match("/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$/", $timestamp))
85  {
86  $timestamp = preg_replace("/\\D/", "", $timestamp);
87  }
88 
89  if (preg_match("/^\\d{14}$/", $timestamp))
90  {
91  $yyyy = substr($timestamp,0,4);
92  $mm = substr($timestamp,4,2);
93  $dd = substr($timestamp,6,2);
94  $hh = substr($timestamp,8,2);
95  $mi = substr($timestamp,10,2);
96  $ss = substr($timestamp,12,2);
97 
98  if ($yyyy == '0000')
99  $text = "N/A";
100 
101  if($timestamp)
102  $text = date($template, mktime($hh,$mi,$ss,$mm,$dd,$yyyy));
103  }
104  else
105  {
106  $text = date($template, strftime($timestamp));
107  }*/
108 
109  return $text;
110  }
static translationDateTemplate($template, $includeTime=true)
trace($msg, $lvl, $callStack=null)
Send output to the trace log.
Definition: functions.inc:959

◆ TimestampTypeRenderer()

TimestampTypeRenderer::TimestampTypeRenderer ( )

Definition at line 40 of file timestamp_type_renderer.inc.

41  {
42  }

The documentation for this class was generated from the following file: