eden / timezone
Eden timezone component.
Installs: 8 442
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 13
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.1
- eden/core: 4.*
README
====
Install
composer install eden/timezone
====
Introduction
Instantiate timezone in this manner.
$timezone = eden('timezone', time(), 'GMT');
====
API
====
convertTo
Convert current time set here to another time zone
Usage
eden('timezone', time(), 'GMT')->convertTo(*string $zone, string|null $format);
Parameters
*string $zone
- valid UTC, GMT, PHP Location or TZ Abbreviationstring|null $format
- format
Returns string|int
Example
eden('timezone', time(), 'GMT')->convertTo('Asia/Manila');
====
getGMT
Returns the GMT Format
Usage
eden('timezone', time(), 'GMT')->getGMT(string $prefix);
Parameters
string $prefix
- Prefix to add before the returned value
Returns string
Example
eden('timezone', time(), 'GMT')->getGMT();
====
getGMTDates
Returns a list of GMT formats and dates in a 24 hour period
Usage
eden('timezone', time(), 'GMT')->getGMTDates(*string $format, int $interval, string|null $prefix);
Parameters
*string $format
- The format of each date to displayint $interval
- The frequency of rowsstring|null $prefix
- The prefix to add before each date display
Returns array
Example
eden('timezone', time(), 'GMT')->getGMTDates('F d, Y');
====
getOffset
Returns the current offset of this timezone
Usage
eden('timezone', time(), 'GMT')->getOffset();
Parameters
Returns int
====
getOffsetDates
Returns a list of offsets and dates in a 24 hour period
Usage
eden('timezone', time(), 'GMT')->getOffsetDates(*string $format, int $interval);
Parameters
*string $format
- The format of each date to displayint $interval
- The frequency of rows
Returns array
Example
eden('timezone', time(), 'GMT')->getOffsetDates('F d, Y');
====
getTime
Returns the time or date
Usage
eden('timezone', time(), 'GMT')->getTime(string|null $format);
Parameters
string|null $format
- Time format
Returns string|int
Example
eden('timezone', time(), 'GMT')->getTime();
====
getUTC
Returns the UTC Format
Usage
eden('timezone', time(), 'GMT')->getUTC(string|null $prefix);
Parameters
string|null $prefix
- The prefix to add before the returned value
Returns string
Example
eden('timezone', time(), 'GMT')->getUTC();
====
getUTCDates
Returns a list of UTC formats and dates in a 24 hour period
Usage
eden('timezone', time(), 'GMT')->getUTCDates(*string $format, int $interval, string|null $prefix);
Parameters
*string $format
- The format of each date to displayint $interval
- The frequency of rowsstring|null $prefix
- The prefix to add before each date display
Returns array
Example
eden('timezone', time(), 'GMT')->getUTCDates('F d, Y');
====
toRelative
Returns the relative distance $time > this->time = ago
Usage
eden('timezone', time(), 'GMT')->toRelative(int|string $time, int $level, string $default);
Parameters
int|string $time
- The time to make relativeint $level
- The granular levelstring $default
- The default date format
Returns Eden\Timezone\Index
Example
eden('timezone', time(), 'GMT')->toRelative();
====
setTime
Sets a new time
Usage
eden('timezone', time(), 'GMT')->setTime(*int|string $time);
Parameters
*int|string $time
- The time value
Returns Eden\Timezone\Index
Example
eden('timezone', time(), 'GMT')->setTime(time() + 123);
====
validation
Returns timezone's validation methods
Usage
eden('timezone', time(), 'GMT')->validation();
Parameters
Returns Eden\Timezone\Index
====
Contributions to Eden are following the Github work flow. Please read up before contributing.
##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.