Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Date

Class Date

Provides methods useful in formatting dates and date timestamps.

Package: minPHP\helpers\date
Located at helpers/date/date.php

Methods summary

public
# __construct( array $formats = null, mixed $timezone_from = null, mixed $timezone_to = null )

Constructs a new Date component using the given date formats in $formats.

Constructs a new Date component using the given date formats in $formats.

Parameters

$formats
array
$formats An array of key/value pairs of PHP date format strings with the following keys: -date A date -day A date with day reference -month A month and year date -year A year date only -date_time A date time
$timezone_from
$timezone_to

See

Date::cast()
public this
# setTimezone( string $from = null, string $to = null )

Set the current time zone to be used during date calculations

Set the current time zone to be used during date calculations

Parameters

$from
string
$from The timezone to convert from
$to
string
$to The timezone to convert to

Returns

this
public this
# setFormats( array $formats = null )

Sets the formats to use as the pre-defined types.

Sets the formats to use as the pre-defined types.

Parameters

$formats
array
$formats An array of key/value pairs of PHP date format strings with the following keys: -date A date -day A date with day reference -month A month and year date -year A year date only -date_time A date time

Returns

this
public string
# cast( string $date, string $format = "date" )

Format a date using one of the date formats provided to the constructor, or predefined in this class.

Format a date using one of the date formats provided to the constructor, or predefined in this class.

Parameters

$date
string
$date The date string to cast into another format, also handles Unix time stamps
$format
string
$format A predefined date format in Date::$formats, a Date constant, or a date string.

Returns

string
The date formatted using the given format rule, null on error
public string
# dateRange( string $start, string $end, array $formats = null )

Format two dates to represent a range between them.

Format two dates to represent a range between them.

Parameters

$start
string
$start The start date
$end
string
$end The end date
$formats
array
$formats An array of 'start' and 'end' indexes, supplying options for 'same_day', 'same_month', 'same_year', and 'other' formats. Select indexes can be supplied to overwrite only specific rules.

Returns

string
The date range, null on error
public string
# format( string $format, string $date = null )

Format a date using the supply date string

Format a date using the supply date string

Parameters

$format
string
$format The format to use
$date
string
$date The date to format

Returns

string
The formatted date
public integer
# toTime( string $date )

Convert a date string to Unix time

Convert a date string to Unix time

Parameters

$date
string
A date string

Returns

integer
The Unix timestamp of the given date
public array
# getMonths( integer $start = 1, integer $end = 12, string $key_format = "m", string $value_format = "F" )

Returns an array of months in key/value pairs

Returns an array of months in key/value pairs

Parameters

$start
integer
$start The start month (1 = Jan, 12 = Dec)
$end
integer
$end The end month
$key_format
string
$key_format The format for the key
$value_format
string
$value_format The format for the value

Returns

array
An array of key/value pairs representing the range of months
public array
# getYears( integer $start, integer $end, string $key_format = "y", string $value_format = "Y" )

Returns an array of keys in key/value pairs

Returns an array of keys in key/value pairs

Parameters

$start
integer
$start The 4-digit start year
$end
integer
$end The 4-digit end year
$key_format
string
$key_format The format for the key
$value_format
string
$value_format The format for the value

Returns

array
An array of key/value pairs representing the range of years
public array
# getTimezones( string $country = null )

Retrieve all timezones or those for a specific country

Retrieve all timezones or those for a specific country

Parameters

$country
string
$country The ISO 3166-1 2-character country code to fetch timezone information for (PHP 5.3 or greater)

Returns

array
An array of all timezones (or those for the given country) indexed by primary locale, then numerically indexed for each timezone in that locale

Magic methods summary

Constants summary

string ATOM "Y-m-d\TH:i:sP"
#
string COOKIE "l, d-M-y H:i:s T"
#
string ISO8601 "Y-m-d\TH:i:sO"
#
string RFC822 "D, d M y H:i:s O"
#
string RFC850 "l, d-M-y H:i:s T"
#
string RFC1036 "D, d M y H:i:s O"
#
string RFC1123 "D, d M Y H:i:s O"
#
string RFC2822 "D, d M Y H:i:s O"
#
string RFC3339 "Y-m-d\TH:i:sP"
#
string RSS "D, d M Y H:i:s O"
#
string W3C "Y-m-d\TH:i:sP"
#
Blesta API documentation generated by ApiGen 2.8.0