Merge branch 'feature/gh-7' into develop

# Conflicts:
#	src/PhpSpreadsheet/Shared/Date.php
This commit is contained in:
MarkBaker 2016-08-17 00:40:55 +01:00
commit e0a9f9e1ec
1 changed files with 15 additions and 14 deletions

View File

@ -113,7 +113,8 @@ class Date
/**
* Set the Default timezone to use for dates
*
* @param string|\DateTimeZone $timezone The timezone to set for all Excel datetimestamp to PHP DateTime Object conversions
* @param string|\DateTimeZone $timeZone The timezone to set for all Excel datetimestamp to PHP DateTime Object conversions
* @return boolean Success or failure
* @throws \Exception
* @return bool Success or failure
*/
@ -145,7 +146,8 @@ class Date
/**
* Validate a timezone
*
* @param string|\DateTimeZone $timezone The timezone to validate, either as a timezone string or object
* @param string|\DateTimeZone $timeZone The timezone to validate, either as a timezone string or object
* @return \DateTimeZone The timezone as a timezone object
* @throws \Exception
* @return \DateTimeZone The timezone as a timezone object
*/
@ -162,8 +164,8 @@ class Date
/**
* Convert a MS serialized datetime value from Excel to a PHP Date/Time object
*
* @param int|float $dateValue MS Excel serialized date/time value
* @param \DateTimeZone|string|null $timezone The timezone to assume for the Excel timestamp,
* @param integer|float $excelTimestamp MS Excel serialized date/time value
* @param \DateTimeZone|string|null $timeZone The timezone to assume for the Excel timestamp,
* if you don't want to treat it as a UTC value
* Use the default (UST) unless you absolutely need a conversion
* @throws \Exception
@ -201,8 +203,8 @@ class Date
/**
* Convert a MS serialized datetime value from Excel to a unix timestamp
*
* @param int|float $dateValue MS Excel serialized date/time value
* @param \DateTimeZone|string|null $timezone The timezone to assume for the Excel timestamp,
* @param integer|float $excelTimestamp MS Excel serialized date/time value
* @param \DateTimeZone|string|null $timeZone The timezone to assume for the Excel timestamp,
* if you don't want to treat it as a UTC value
* Use the default (UST) unless you absolutely need a conversion
* @throws \Exception
@ -217,16 +219,16 @@ class Date
/**
* Convert a date from PHP to an MS Excel serialized date/time value
*
* @param mixed $dateValue PHP serialized date/time or date object
* @return float|bool Excel date/time value
* @param mixed $dateValue Unix Timestamp or PHP DateTime object or a string
* @return float|boolean Excel date/time value
* or boolean FALSE on failure
*/
public static function PHPToExcel($dateValue = 0)
{
if ((is_object($dateValue)) && ($dateValue instanceof \DateTimeInterface)) {
return self::DateTimeToExcel($dateValue);
return self::dateTimeToExcel($dateValue);
} elseif (is_numeric($dateValue)) {
return self::TimestampToExcel($dateValue);
return self::timestampToExcel($dateValue);
} elseif (is_string($dateValue)) {
return self::stringToExcel($dateValue);
}
@ -235,7 +237,7 @@ class Date
}
/**
* Convert a DateTime object to an MS Excel serialized date/time value
* Convert a PHP DateTime object to an MS Excel serialized date/time value
*
* @param \DateTimeInterface $dateValue PHP DateTime object
* @return float MS Excel serialized date/time value
@ -255,7 +257,7 @@ class Date
/**
* Convert a Unix timestamp to an MS Excel serialized date/time value
*
* @param \DateTimeInterface $dateValue PHP DateTime object
* @param \DateTimeInterface $dateValue Unix Timestamp
* @return float MS Excel serialized date/time value
*/
public static function timestampToExcel($dateValue = 0)
@ -263,8 +265,7 @@ class Date
if (!is_numeric($dateValue)) {
return false;
}
return self::DateTimeToExcel(new \DateTime('@' . $dateValue));
return self::dateTimeToExcel(new \DateTime('@' . $dateValue));
}
/**