DateTime
extends Carbon
in package
DateTime class that extends Carbon
This class is a wrapper around the Carbon date/time library. It provides the same functionality as Carbon, but with additional methods and properties that are specific to the Atom framework.
Tags
Table of Contents
Properties
- $isSetConfig : bool
- Whether the global configuration has been set.
- $isSetDefine : bool
- Whether the global define for the Atom framework has been set.
- $isSetMacro : bool
- Whether the global macro has been set.
Methods
- __toString() : string
- Returns a string representation of the DateTime object.
- setDefaultLocale() : void
- Set the default locale.
- setDefaultTimezone() : bool
- Set the default timezone.
- setGlobalDefine() : void
- Set the global define for the Atom framework
- setMacro() : bool
- Set the global macro for the Atom framework
Properties
$isSetConfig
Whether the global configuration has been set.
private
static bool
$isSetConfig
= false
This variable is used to track whether the global configuration has been set or not. It is set to true when the global configuration is set and false otherwise.
$isSetDefine
Whether the global define for the Atom framework has been set.
private
static bool
$isSetDefine
= false
This variable is used to track whether the global define for the Atom framework has been set or not. It is set to true when the global define is set and false otherwise.
$isSetMacro
Whether the global macro has been set.
private
static bool
$isSetMacro
= false
This variable is used to track whether the global macro has been set or not. It is set to true when the global macro is set and false otherwise.
Methods
__toString()
Returns a string representation of the DateTime object.
public
__toString() : string
This method returns a string representation of the DateTime object. If the ATOM_DATETIME constant is defined, the method will use that format. Otherwise, it will use the 'Y-m-d H:i:s' format.
Return values
string —A string representation of the DateTime object.
setDefaultLocale()
Set the default locale.
public
static setDefaultLocale() : void
This method sets the default locale for the Atom framework. It sets the locale to the value of the ATOM_LOCALE define if it is set, otherwise it sets the locale to the 'en_US' locale.
setDefaultTimezone()
Set the default timezone.
public
setDefaultTimezone() : bool
This method sets the default timezone for the DateTime object. It sets the timezone to the value of the ATOM_TIMEZONE define if it is set, otherwise it sets the timezone to the 'UTC' timezone.
Return values
bool —True if the timezone is set, false otherwise.
setGlobalDefine()
Set the global define for the Atom framework
public
static setGlobalDefine(object $config) : void
This method sets the global define for the Atom framework. It sets the timezone, datetime, date, time, and locale defines.
Parameters
- $config : object
-
The configuration object
setMacro()
Set the global macro for the Atom framework
public
static setMacro() : bool
This method sets the global macro for the Atom framework. It sets the native, atom, and toAtom macros.
Return values
bool —True if the macro is set, false otherwise.