- Symphony 2.2.3
-
› assets
11 -
› boot
9 -
› core
22 -
› email-gateways
3 -
› toolkit
67 -
› Unknown
33 - Delegates87
- Deprecated30
Versions
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.3
- 2.7.2
- 2.7.10
- 2.7.1
- 2.7.0
- 2.6.9
- 2.6.8
- 2.6.7
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.11
- 2.6.10
- 2.6.1
- 2.6.0
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
Options
public class DateTimeObj
class.datetimeobj.php #12The DateTimeObj provides static functions regarding dates in Symphony. Symphony will set the default timezone of the system using it's configuration values.
Methods
static string dateFormatToStrftime(
$dateFormat)
Convert a date format to a strftime
format
Timezone conversion is done for unix. Windows users must exchange %z and %Z.
Unsupported date
formats : S, n, t, L, B, G, u, e, I, P, Z, c, r
Unsupported strftime
formats : %U, %W, %C, %g, %r, %R, %T, %X, %c, %D, %F, %x
Parameters
See Also
static string format(
$string, $format, $localize, $timezone)
Formats the given date and time $string
based on the given $format
.
Optionally the result will be localized and respect a timezone differing
from the system default. The default output is ISO 8601.
Parameters
Returns
The formatted date
static string get(
$format, $timestamp, $timezone)
Given a $format
, and a $timestamp
,
return the date in the format provided. This function is a basic
wrapper for PHP's DateTime object. If the $timestamp
is omitted,
the current timestamp will be used. Optionally, you pass a
timezone identifier with this function to localise the output
If you like to display a date in the backend, please make use
of DateTimeObj::format()
which allows date and time localization
Parameters
Returns
The formatted date
See Also
static string getGMT(
$format, $timestamp)
A wrapper for get, this function will force the GMT timezone.
Parameters
Returns
The formatted date in GMT
static string getTimeAgo(
$format)
A wrapper for get, this function will return a HTML string representing
an <abbr>
element which contained the formatted date of now, and an
RFC 2822 formatted date (Thu, 21 Dec 2000 16:01:07 +0200) as the title
attribute. Symphony uses this in it's status messages so that it can
dynamically update how long ago the action took place using Javascript.
Parameters
Returns
A HTML string of an <abbr>
element with a class of 'timeago' and the current date (RFC 2822) as the title element. The value is the current time as specified by the $format
.
static void setDefaultTimezone(
$timezone)
Uses PHP's datedefaulttimezone_set function to set the system
timezone. If the timezone provided is invalid, a E_USER_WARNING
will be
raised.
Parameters
See Also
static boolean validate(
$string)
Validate a given date and time string
Parameters
Returns
Returns true for valid dates, otherwise false