class PHPExcel_Shared_Date

PHPExcelSharedDate

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

Constants

CALENDAR_WINDOWS_1900

constants

CALENDAR_MAC_1904

Properties

static $monthNames
static $numberSuffixes

Methods

static boolean
setExcelCalendar(integer $baseDate)

Set the Excel calendar (Windows 1900 or Mac 1904)

static integer
getExcelCalendar()

Return the Excel calendar (Windows 1900 or Mac 1904)

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

Convert a date from Excel to PHP

static DateTime
ExcelToPHPObject(integer $dateValue)

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

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

Convert a date from PHP to Excel

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

FormattedPHPToExcel

static boolean
isDateTime(PHPExcel_Cell $pCell)

Is a given cell a date/time?

static boolean
isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat)

Is a given number format a date/time?

static boolean
isDateTimeFormatCode(string $pFormatCode = '')

Is a given number format code a date/time?

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

Convert a date/time string to Excel time

static integer|string
monthStringToNumber(string $month)

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

static integer|string
dayStringToNumber(string $day)

Strips an ordinal froma numeric value

Details

at line 93
static boolean setExcelCalendar(integer $baseDate)

Set the Excel calendar (Windows 1900 or Mac 1904)

Parameters

integer $baseDate Excel base date (1900 or 1904)

Return Value

boolean Success or failure

at line 109
static integer getExcelCalendar()

Return the Excel calendar (Windows 1900 or Mac 1904)

Return Value

integer Excel base date (1900 or 1904)

at line 124
static ExcelToPHP($dateValue, $adjustToTimezone = false, $timezone = null)

Convert a date from Excel to PHP

@param integer $dateValue Excel date/time value

Parameters

$dateValue
$adjustToTimezone
$timezone

at line 164
static DateTime ExcelToPHPObject(integer $dateValue)

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

Parameters

integer $dateValue Excel date/time value

Return Value

DateTime PHP date/time object

at line 190
static PHPToExcel($dateValue, $adjustToTimezone = false, $timezone = null)

Convert a date from PHP to Excel

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

Parameters

$dateValue
$adjustToTimezone
$timezone

at line 226
static integer FormattedPHPToExcel(integer $year, integer $month, integer $day, integer $hours, integer $minutes, integer $seconds)

FormattedPHPToExcel

Parameters

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

Return Value

integer Excel date/time value

at line 268
static boolean isDateTime(PHPExcel_Cell $pCell)

Is a given cell a date/time?

Parameters

PHPExcel_Cell $pCell

Return Value

boolean

at line 284
static boolean isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat)

Is a given number format a date/time?

Parameters

PHPExcel_Style_NumberFormat $pFormat

Return Value

boolean

at line 298
static boolean isDateTimeFormatCode(string $pFormatCode = '')

Is a given number format code a date/time?

Parameters

string $pFormatCode

Return Value

boolean

at line 370
static float|FALSE stringToExcel(string $dateValue = '')

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'

Return Value

float|FALSE Excel date/time serial value

at line 401
static integer|string monthStringToNumber(string $month)

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

Parameters

string $month Month name or abbreviation

Return Value

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

at line 419
static integer|string dayStringToNumber(string $day)

Strips an ordinal froma numeric value

Parameters

string $day Day number with an ordinal

Return Value

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