Add notes for the Timezone functions in Date class (#431)

The \PhpOffice\PhpSpreadsheet\Shared\Date class has support for setting an alternate timezone which affects the conversion of Excel Date timestamps in PhpSpreadsheet. This amendment is an effort to document this support.
This commit is contained in:
netpassprod1 2018-03-21 21:51:29 -04:00 committed by Adrien Crivelli
parent 46a2c4106a
commit 52ff262ddb
1 changed files with 22 additions and 0 deletions

View File

@ -263,6 +263,28 @@ return an Excel date timestamp.
Takes year, month and day values (and optional hour, minute and second
values) and returns an Excel date timestamp value.
### Timezone support for Excel date timestamp conversions
The default timezone for the date functions in PhpSpreadsheet is UST (Universal Standard Time).
If a different timezone needs to be used, these methods are available:
#### \PhpOffice\PhpSpreadsheet\Shared\Date::getDefaultTimezone()
Returns the current timezone value PhpSpeadsheet is using to handle dates and times.
#### \PhpOffice\PhpSpreadsheet\Shared\Date::setDefaultTimezone($timeZone)
Sets the timezone for Excel date timestamp conversions to $timeZone,
which must be a valid PHP DateTimeZone value.
The return value is a Boolean, where true is success,
and false is failure (e.g. an invalid DateTimeZone value was passed.)
#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDate, $timeZone)
#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimeStamp($excelDate, $timeZone)
These functions support a timezone as an optional second parameter.
This applies a specific timezone to that function call without affecting the default PhpSpreadsheet Timezone.
## Function Reference
### Database Functions