
====, (*1)
, (*2)
Install
composer install eden/timezone, (*3)
====, (*4)
, (*5)
Introduction
Instantiate timezone in this manner., (*6)
$timezone = eden('timezone', time(), 'GMT');
====, (*7)
, (*8)
API
====, (*9)
, (*10)
convertTo
Convert current time set here to another time zone, (*11)
Usage
eden('timezone', time(), 'GMT')->convertTo(*string $zone, string|null $format);
Parameters
-
*string $zone - valid UTC, GMT, PHP Location or TZ Abbreviation
-
string|null $format - format
Returns string|int, (*12)
Example
eden('timezone', time(), 'GMT')->convertTo('Asia/Manila');
====, (*13)
, (*14)
getGMT
Returns the GMT Format, (*15)
Usage
eden('timezone', time(), 'GMT')->getGMT(string $prefix);
Parameters
-
string $prefix - Prefix to add before the returned value
Returns string, (*16)
Example
eden('timezone', time(), 'GMT')->getGMT();
====, (*17)
, (*18)
getGMTDates
Returns a list of GMT formats and dates in a 24 hour period, (*19)
Usage
eden('timezone', time(), 'GMT')->getGMTDates(*string $format, int $interval, string|null $prefix);
Parameters
-
*string $format - The format of each date to display
-
int $interval - The frequency of rows
-
string|null $prefix - The prefix to add before each date display
Returns array, (*20)
Example
eden('timezone', time(), 'GMT')->getGMTDates('F d, Y');
====, (*21)
, (*22)
getOffset
Returns the current offset of this timezone, (*23)
Usage
eden('timezone', time(), 'GMT')->getOffset();
Parameters
Returns int, (*24)
====, (*25)
, (*26)
getOffsetDates
Returns a list of offsets and dates in a 24 hour period, (*27)
Usage
eden('timezone', time(), 'GMT')->getOffsetDates(*string $format, int $interval);
Parameters
-
*string $format - The format of each date to display
-
int $interval - The frequency of rows
Returns array, (*28)
Example
eden('timezone', time(), 'GMT')->getOffsetDates('F d, Y');
====, (*29)
, (*30)
getTime
Returns the time or date, (*31)
Usage
eden('timezone', time(), 'GMT')->getTime(string|null $format);
Parameters
-
string|null $format - Time format
Returns string|int, (*32)
Example
eden('timezone', time(), 'GMT')->getTime();
====, (*33)
, (*34)
getUTC
Returns the UTC Format, (*35)
Usage
eden('timezone', time(), 'GMT')->getUTC(string|null $prefix);
Parameters
-
string|null $prefix - The prefix to add before the returned value
Returns string, (*36)
Example
eden('timezone', time(), 'GMT')->getUTC();
====, (*37)
, (*38)
getUTCDates
Returns a list of UTC formats and dates in a 24 hour period, (*39)
Usage
eden('timezone', time(), 'GMT')->getUTCDates(*string $format, int $interval, string|null $prefix);
Parameters
-
*string $format - The format of each date to display
-
int $interval - The frequency of rows
-
string|null $prefix - The prefix to add before each date display
Returns array, (*40)
Example
eden('timezone', time(), 'GMT')->getUTCDates('F d, Y');
====, (*41)
, (*42)
toRelative
Returns the relative distance $time > this->time = ago, (*43)
Usage
eden('timezone', time(), 'GMT')->toRelative(int|string $time, int $level, string $default);
Parameters
-
int|string $time - The time to make relative
-
int $level - The granular level
-
string $default - The default date format
Returns Eden\Timezone\Index, (*44)
Example
eden('timezone', time(), 'GMT')->toRelative();
====, (*45)
, (*46)
setTime
Sets a new time, (*47)
Usage
eden('timezone', time(), 'GMT')->setTime(*int|string $time);
Parameters
-
*int|string $time - The time value
Returns Eden\Timezone\Index, (*48)
Example
eden('timezone', time(), 'GMT')->setTime(time() + 123);
====, (*49)
, (*50)
validation
Returns timezone's validation methods, (*51)
Usage
eden('timezone', time(), 'GMT')->validation();
Parameters
Returns Eden\Timezone\Index, (*52)
====, (*53)
, (*54)
Contributing to Eden
Contributions to Eden are following the Github work flow. Please read up before contributing., (*55)
Setting up your machine with the Eden repository and your fork
- Fork the repository
- Fire up your local terminal create a new branch from the
v4 branch of your
fork with a branch name describing what your changes are.
Possible branch name types:
- bugfix
- feature
- improvement
- Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")
Making pull requests
- Please ensure to run
phpunit before making a pull request.
- Push your code to your remote forked version.
- Go back to your forked version on GitHub and submit a pull request.
- An Eden developer will review your code and merge it in when it has been classified as suitable.