Overview
Helper for a formatted timestamp using » date() format codes.
Default format is "Y-m-d H:i:s".
Note that this helper is timezone-aware. For example, if all your input timestamps are in the GMT timezone, but you want to show them as being in the America/Chicago timezone, you can set these config keys:
<?php
$config['Solar_View_Helper_Timestamp']['tz_origin'] = 'GMT';
$config['Solar_View_Helper_Timestamp']['tz_output'] = 'America/Chicago';
Then when you call call the timestamp helper, it will move the input time back by 5 hours (or by 6, during daylight savings time) and output that instead of the GMT time.
This works for arbitrary timezones, so you can have your input times in any timezone and convert them to any other timezone.
Note that Solar_View_Helper_Date and Solar_View_Helper_Time descend from this helper, so you only need to set the timezone configs in one place (i.e., for this helper).
Package
This class is part of the Solar_View_Helper package.
Inheritance:
Solar_View_Helper_Timestamp
Configuration Keys
strftime
: When true, uses strftime() instead of date() for formatting dates. Default is false.format
: The default output formatting using » date() codes. Whenstrftime
is true, uses » strftime() codes instead. Default is 'Y-m-d H:i:s' (using date() format codes).tz_origin
: Consider all input timestamps as being from this timezone. Default is the value of » date_default_timezone_get().tz_output
: Output all timestamps after converting to this timezone. Default is the value of » date_default_timezone_get().
Constants
None.
Public Properties
The Solar_View_Helper_Timestamp class has no public properties; try the list of all properties.
Public Methods
These are all the public methods in the Solar_View_Helper_Timestamp class.
You can also view the list of all public, protected, and private methods.
-
__construct()
-
Constructor.
-
__destruct()
-
Default destructor; does nothing other than provide a safe fallback for calls to parent::__destruct().
-
dump()
-
Convenience method for getting a dump the whole object, or one of its properties, or an external variable.
-
locale()
-
Looks up class-specific locale strings based on a key.
-
timestamp()
-
Outputs a formatted timestamp using » date() format codes.