\PHPExcel_Shared_Date

PHPExcel_Shared_Date

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Summary

Methods
Properties
Constants
setExcelCalendar()
getExcelCalendar()
ExcelToPHP()
ExcelToPHPObject()
PHPToExcel()
FormattedPHPToExcel()
isDateTime()
isDateTimeFormat()
isDateTimeFormatCode()
stringToExcel()
monthStringToNumber()
dayStringToNumber()
$monthNames
$numberSuffixes
CALENDAR_WINDOWS_1900
CALENDAR_MAC_1904
No protected methods found
$excelBaseDate
N/A
No private methods found
$possibleDateFormatCharacters
N/A

Constants

CALENDAR_WINDOWS_1900

CALENDAR_WINDOWS_1900 = 1900

constants

CALENDAR_MAC_1904

CALENDAR_MAC_1904 = 1904

Properties

$monthNames

$monthNames : 

Type

$numberSuffixes

$numberSuffixes : 

Type

$excelBaseDate

$excelBaseDate : 

Type

$possibleDateFormatCharacters

$possibleDateFormatCharacters : 

Type

Methods

setExcelCalendar()

setExcelCalendar(integer  $baseDate) : boolean

Set the Excel calendar (Windows 1900 or Mac 1904)

Parameters

integer $baseDate

Excel base date (1900 or 1904)

Returns

boolean —

Success or failure

getExcelCalendar()

getExcelCalendar() : integer

Return the Excel calendar (Windows 1900 or Mac 1904)

Returns

integer —

Excel base date (1900 or 1904)

ExcelToPHP()

ExcelToPHP(  $dateValue, boolean  $adjustToTimezone = false,   $timezone = null) 

Convert a date from Excel to PHP

@param integer $dateValue Excel date/time value

Parameters

$dateValue
boolean $adjustToTimezone

Flag indicating whether $dateValue should be treated as a UST timestamp, or adjusted to UST @param string $timezone The timezone for finding the adjustment from UST @return integer PHP serialized date/time

$timezone

ExcelToPHPObject()

ExcelToPHPObject(integer  $dateValue) : \DateTime

Convert a date from Excel to a PHP Date/Time object

Parameters

integer $dateValue

Excel date/time value

Returns

\DateTime —

PHP date/time object

PHPToExcel()

PHPToExcel(  $dateValue, boolean  $adjustToTimezone = false,   $timezone = null) 

Convert a date from PHP to Excel

@param mixed $dateValue PHP serialized date/time or date object

Parameters

$dateValue
boolean $adjustToTimezone

Flag indicating whether $dateValue should be treated as a UST timestamp, or adjusted to UST @param string $timezone The timezone for finding the adjustment from UST @return mixed Excel date/time value or boolean FALSE on failure

$timezone

FormattedPHPToExcel()

FormattedPHPToExcel(integer  $year, integer  $month, integer  $day, integer  $hours, integer  $minutes, integer  $seconds) : integer

FormattedPHPToExcel

Parameters

integer $year
integer $month
integer $day
integer $hours
integer $minutes
integer $seconds

Returns

integer —

Excel date/time value

isDateTime()

isDateTime(\PHPExcel_Cell  $pCell) : boolean

Is a given cell a date/time?

Parameters

\PHPExcel_Cell $pCell

Returns

boolean

isDateTimeFormat()

isDateTimeFormat(\PHPExcel_Style_NumberFormat  $pFormat) : boolean

Is a given number format a date/time?

Parameters

\PHPExcel_Style_NumberFormat $pFormat

Returns

boolean

isDateTimeFormatCode()

isDateTimeFormatCode(string  $pFormatCode = '') : boolean

Is a given number format code a date/time?

Parameters

string $pFormatCode

Returns

boolean

stringToExcel()

stringToExcel(string  $dateValue = '') : float|FALSE

Convert a date/time string to Excel time

Parameters

string $dateValue

Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'

Returns

float|FALSE —

Excel date/time serial value

monthStringToNumber()

monthStringToNumber(string  $month) : integer|string

Converts a month name (either a long or a short name) to a month number

Parameters

string $month

Month name or abbreviation

Returns

integer|string —

Month number (1 - 12), or the original string argument if it isn't a valid month name

dayStringToNumber()

dayStringToNumber(string  $day) : integer|string

Strips an ordinal froma numeric value

Parameters

string $day

Day number with an ordinal

Returns

integer|string —

The integer value with any ordinal stripped, or the original string argument if it isn't a valid numeric