File Source for DateTime.php

PHPExcel_Calculation

# Source for file DateTime.php

Documentation is available at DateTime.php

1. <?php
2. /**
3. * PHPExcel
4. *
5. * Copyright (c) 2006 - 2011 PHPExcel
6. *
7. * This library is free software; you can redistribute it and/or
8. * modify it under the terms of the GNU Lesser General Public
9. * License as published by the Free Software Foundation; either
10. * version 2.1 of the License, or (at your option) any later version.
11. *
12. * This library is distributed in the hope that it will be useful,
13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15. * Lesser General Public License for more details.
16. *
17. * You should have received a copy of the GNU Lesser General Public
18. * License along with this library; if not, write to the Free Software
19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20. *
21. * @category PHPExcel
22. * @package PHPExcel_Calculation
23. * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25. * @version 1.7.6, 2011-02-27
26. */
29. /** PHPExcel root directory */
30. if (! defined('PHPEXCEL_ROOT')) {
31. /**
32. * @ignore
33. */
34. define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
35. require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
36. }
39. /**
40. * PHPExcel_Calculation_DateTime
41. *
42. * @category PHPExcel
43. * @package PHPExcel_Calculation
44. * @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
45. */
46. class PHPExcel_Calculation_DateTime {
48. public static function _isLeapYear($year) {
49. return ((($year % 4) == 0) && (($year % 100) != 0) || (($year % 400) == 0));
50. } // function _isLeapYear()
53. private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) {
54. if ($startDay == 31) {
55. --$startDay;
56. } elseif ($methodUS && ($startMonth == 2 && ($startDay == 29 || ($startDay == 28 && ! self::_isLeapYear($startYear))))) {
57. $startDay = 30;
58. }
59. if ($endDay == 31) {
60. if ($methodUS && $startDay != 30) {
61. $endDay = 1;
62. if ($endMonth == 12) {
63. ++$endYear;
64. $endMonth = 1;
65. } else {
66. ++$endMonth;
67. }
68. } else {
69. $endDay = 30;
70. }
71. }
73. return $endDay + $endMonth * 30 + $endYear * 360 - $startDay - $startMonth * 30 - $startYear * 360;
74. } // function _dateDiff360()
77. /**
78. * _getDateValue
79. *
80. * @param string $dateValue
81. * @return mixed Excel date/time serial value, or string if error
82. */
83. public static function _getDateValue($dateValue) {
84. if (! is_numeric($dateValue)) {
85. if (( is_string($dateValue)) && ( PHPExcel_Calculation_Functions:: getCompatibilityMode() == PHPExcel_Calculation_Functions:: COMPATIBILITY_GNUMERIC)) {
86. return PHPExcel_Calculation_Functions:: VALUE();
87. }
88. if (( is_object($dateValue)) && ($dateValue instanceof PHPExcel_Shared_Date::$dateTimeObjectType)) {
89. $dateValue = PHPExcel_Shared_Date:: PHPToExcel($dateValue);
90. } else {
91. $saveReturnDateType = PHPExcel_Calculation_Functions:: getReturnDateType();
92. PHPExcel_Calculation_Functions:: setReturnDateType( PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL);
93. $dateValue = self:: DATEVALUE($dateValue);
94. PHPExcel_Calculation_Functions:: setReturnDateType($saveReturnDateType);
95. }
96. }
97. return $dateValue;
98. } // function _getDateValue()
101. /**
102. * _getTimeValue
103. *
104. * @param string $timeValue
105. * @return mixed Excel date/time serial value, or string if error
106. */
107. private static function _getTimeValue($timeValue) {
108. $saveReturnDateType = PHPExcel_Calculation_Functions:: getReturnDateType();
109. PHPExcel_Calculation_Functions:: setReturnDateType( PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL);
110. $timeValue = self:: TIMEVALUE($timeValue);
111. PHPExcel_Calculation_Functions:: setReturnDateType($saveReturnDateType);
112. return $timeValue;
113. } // function _getTimeValue()
116. private static function _adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0) {
117. // Execute function
118. $PHPDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($dateValue);
119. $oMonth = (int) $PHPDateObject->format('m');
120. $oYear = (int) $PHPDateObject->format('Y');
122. $adjustmentMonthsString = (string) $adjustmentMonths;
123. if ($adjustmentMonths > 0) {
124. $adjustmentMonthsString = '+'.$adjustmentMonths;
125. }
126. if ($adjustmentMonths != 0) {
127. $PHPDateObject->modify($adjustmentMonthsString.' months');
128. }
129. $nMonth = (int) $PHPDateObject->format('m');
130. $nYear = (int) $PHPDateObject->format('Y');
132. $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12);
133. if ($monthDiff != $adjustmentMonths) {
134. $adjustDays = (int) $PHPDateObject->format('d');
135. $adjustDaysString = '-'.$adjustDays.' days';
136. $PHPDateObject->modify($adjustDaysString);
137. }
138. return $PHPDateObject;
139. } // function _adjustDateByMonths()
142. /**
143. * DATETIMENOW
144. *
145. * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
146. * depending on the value of the ReturnDateType flag
147. */
148. public static function DATETIMENOW() {
149. $saveTimeZone = date_default_timezone_get();
150. date_default_timezone_set('UTC');
151. $retValue = False;
152. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
153. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
154. $retValue = (float) PHPExcel_Shared_Date:: PHPToExcel( time());
155. break;
156. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
157. $retValue = (integer) time();
158. break;
159. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
160. $retValue = new DateTime();
161. break;
162. }
163. date_default_timezone_set($saveTimeZone);
165. return $retValue;
166. } // function DATETIMENOW()
169. /**
170. * DATENOW
171. *
172. * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
173. * depending on the value of the ReturnDateType flag
174. */
175. public static function DATENOW() {
176. $saveTimeZone = date_default_timezone_get();
177. date_default_timezone_set('UTC');
178. $retValue = False;
179. $excelDateTime = floor( PHPExcel_Shared_Date:: PHPToExcel( time()));
180. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
181. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
182. $retValue = (float) $excelDateTime;
183. break;
184. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
185. $retValue = (integer) PHPExcel_Shared_Date:: ExcelToPHP($excelDateTime) - 3600;
186. break;
187. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
188. $retValue = PHPExcel_Shared_Date:: ExcelToPHPObject($excelDateTime);
189. break;
190. }
191. date_default_timezone_set($saveTimeZone);
193. return $retValue;
194. } // function DATENOW()
197. /**
198. * DATE
199. *
200. * @param long $year
201. * @param long $month
202. * @param long $day
203. * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
204. * depending on the value of the ReturnDateType flag
205. */
206. public static function DATE($year = 0, $month = 1, $day = 1) {
207. $year = (integer) PHPExcel_Calculation_Functions:: flattenSingleValue($year);
208. $month = (integer) PHPExcel_Calculation_Functions:: flattenSingleValue($month);
209. $day = (integer) PHPExcel_Calculation_Functions:: flattenSingleValue($day);
211. $baseYear = PHPExcel_Shared_Date:: getExcelCalendar();
212. // Validate parameters
213. if ($year < ($baseYear-1900)) {
214. return PHPExcel_Calculation_Functions:: NaN();
215. }
216. if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) {
217. return PHPExcel_Calculation_Functions:: NaN();
218. }
220. if (($year < $baseYear) && ($year >= ($baseYear-1900))) {
221. $year += 1900;
222. }
224. if ($month < 1) {
225. // Handle year/month adjustment if month < 1
226. --$month;
227. $year += ceil($month / 12) - 1;
228. $month = 13 - abs($month % 12);
229. } elseif ($month > 12) {
230. // Handle year/month adjustment if month > 12
231. $year += floor($month / 12);
232. $month = ($month % 12);
233. }
235. // Re-validate the year parameter after adjustments
236. if (($year < $baseYear) || ($year >= 10000)) {
237. return PHPExcel_Calculation_Functions:: NaN();
238. }
240. // Execute function
241. $excelDateValue = PHPExcel_Shared_Date:: FormattedPHPToExcel($year, $month, $day);
242. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
243. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
244. return (float) $excelDateValue;
245. break;
246. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
247. return (integer) PHPExcel_Shared_Date:: ExcelToPHP($excelDateValue);
248. break;
249. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
250. return PHPExcel_Shared_Date:: ExcelToPHPObject($excelDateValue);
251. break;
252. }
253. } // function DATE()
256. /**
257. * TIME
258. *
259. * @param long $hour
260. * @param long $minute
261. * @param long $second
262. * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
263. * depending on the value of the ReturnDateType flag
264. */
265. public static function TIME($hour = 0, $minute = 0, $second = 0) {
266. $hour = PHPExcel_Calculation_Functions:: flattenSingleValue($hour);
267. $minute = PHPExcel_Calculation_Functions:: flattenSingleValue($minute);
268. $second = PHPExcel_Calculation_Functions:: flattenSingleValue($second);
270. if ($hour == '') { $hour = 0; }
271. if ($minute == '') { $minute = 0; }
272. if ($second == '') { $second = 0; }
274. if ((! is_numeric($hour)) || (! is_numeric($minute)) || (! is_numeric($second))) {
275. return PHPExcel_Calculation_Functions:: VALUE();
276. }
277. $hour = (integer) $hour;
278. $minute = (integer) $minute;
279. $second = (integer) $second;
281. if ($second < 0) {
282. $minute += floor($second / 60);
283. $second = 60 - abs($second % 60);
284. if ($second == 60) { $second = 0; }
285. } elseif ($second >= 60) {
286. $minute += floor($second / 60);
287. $second = $second % 60;
288. }
289. if ($minute < 0) {
290. $hour += floor($minute / 60);
291. $minute = 60 - abs($minute % 60);
292. if ($minute == 60) { $minute = 0; }
293. } elseif ($minute >= 60) {
294. $hour += floor($minute / 60);
295. $minute = $minute % 60;
296. }
298. if ($hour > 23) {
299. $hour = $hour % 24;
300. } elseif ($hour < 0) {
301. return PHPExcel_Calculation_Functions:: NaN();
302. }
304. // Execute function
305. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
306. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
307. $date = 0;
308. $calendar = PHPExcel_Shared_Date:: getExcelCalendar();
309. if ($calendar != PHPExcel_Shared_Date:: CALENDAR_WINDOWS_1900) {
310. $date = 1;
311. }
312. return (float) PHPExcel_Shared_Date:: FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
313. break;
314. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
315. return (integer) PHPExcel_Shared_Date:: ExcelToPHP( PHPExcel_Shared_Date:: FormattedPHPToExcel(1970, 1, 1, $hour-1, $minute, $second)); // -2147468400; // -2147472000 + 3600
316. break;
317. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
318. $dayAdjust = 0;
319. if ($hour < 0) {
320. $dayAdjust = floor($hour / 24);
321. $hour = 24 - abs($hour % 24);
322. if ($hour == 24) { $hour = 0; }
323. } elseif ($hour >= 24) {
324. $dayAdjust = floor($hour / 24);
325. $hour = $hour % 24;
326. }
327. $phpDateObject = new DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second);
328. if ($dayAdjust != 0) {
329. $phpDateObject->modify($dayAdjust.' days');
330. }
331. return $phpDateObject;
332. break;
333. }
334. } // function TIME()
337. /**
338. * DATEVALUE
339. *
340. * @param string $dateValue
341. * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
342. * depending on the value of the ReturnDateType flag
343. */
344. public static function DATEVALUE($dateValue = 1) {
345. $dateValue = trim( PHPExcel_Calculation_Functions:: flattenSingleValue($dateValue),'"');
346. // Strip any ordinals because they're allowed in Excel (English only)
347. $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui','$1$3',$dateValue);
348. // Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
349. $dateValue = str_replace(array('/','.','-',' '),array(' ',' ',' ',' '),$dateValue);
351. $yearFound = false;
352. $t1 = explode(' ',$dateValue);
353. foreach($t1 as &$t) {
354. if (( is_numeric($t)) && ($t > 31)) {
355. if ($yearFound) {
356. return PHPExcel_Calculation_Functions:: VALUE();
357. } else {
358. if ($t < 100) { $t += 1900; }
359. $yearFound = true;
360. }
361. }
362. }
363. if (( count($t1) == 1) && ( strpos($t,':') != false)) {
364. // We've been fed a time value without any date
365. return 0.0;
366. } elseif ( count($t1) == 2) {
367. // We only have two parts of the date: either day/month or month/year
368. if ($yearFound) {
369. array_unshift($t1,1);
370. } else {
371. array_push($t1, date('Y'));
372. }
373. }
374. unset($t);
375. $dateValue = implode(' ',$t1);
377. $PHPDateArray = date_parse($dateValue);
378. if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) {
379. $testVal1 = strtok($dateValue,'- ');
380. if ($testVal1 !== False) {
381. $testVal2 = strtok('- ');
382. if ($testVal2 !== False) {
383. $testVal3 = strtok('- ');
384. if ($testVal3 === False) {
385. $testVal3 = strftime('%Y');
386. }
387. } else {
388. return PHPExcel_Calculation_Functions:: VALUE();
389. }
390. } else {
391. return PHPExcel_Calculation_Functions:: VALUE();
392. }
393. $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3);
394. if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) {
395. $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3);
396. if (($PHPDateArray === False) || ($PHPDateArray['error_count'] > 0)) {
397. return PHPExcel_Calculation_Functions:: VALUE();
398. }
399. }
400. }
402. if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) {
403. // Execute function
404. if ($PHPDateArray['year'] == '') { $PHPDateArray['year'] = strftime('%Y'); }
405. if ($PHPDateArray['month'] == '') { $PHPDateArray['month'] = strftime('%m'); }
406. if ($PHPDateArray['day'] == '') { $PHPDateArray['day'] = strftime('%d'); }
407. $excelDateValue = floor( PHPExcel_Shared_Date:: FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']));
409. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
410. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
411. return (float) $excelDateValue;
412. break;
413. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
414. return (integer) PHPExcel_Shared_Date:: ExcelToPHP($excelDateValue);
415. break;
416. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
417. return new DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00');
418. break;
419. }
420. }
421. return PHPExcel_Calculation_Functions:: VALUE();
422. } // function DATEVALUE()
425. /**
426. * TIMEVALUE
427. *
428. * @param string $timeValue
429. * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
430. * depending on the value of the ReturnDateType flag
431. */
432. public static function TIMEVALUE($timeValue) {
433. $timeValue = trim( PHPExcel_Calculation_Functions:: flattenSingleValue($timeValue),'"');
434. $timeValue = str_replace(array('/','.'),array('-','-'),$timeValue);
436. $PHPDateArray = date_parse($timeValue);
437. if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) {
438. if ( PHPExcel_Calculation_Functions:: getCompatibilityMode() == PHPExcel_Calculation_Functions:: COMPATIBILITY_OPENOFFICE) {
439. $excelDateValue = PHPExcel_Shared_Date:: FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']);
440. } else {
441. $excelDateValue = PHPExcel_Shared_Date:: FormattedPHPToExcel(1900,1,1,$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']) - 1;
442. }
444. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
445. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
446. return (float) $excelDateValue;
447. break;
448. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
449. return (integer) $phpDateValue = PHPExcel_Shared_Date:: ExcelToPHP($excelDateValue+25569) - 3600;;
450. break;
451. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
452. return new DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']);
453. break;
454. }
455. }
456. return PHPExcel_Calculation_Functions:: VALUE();
457. } // function TIMEVALUE()
460. /**
461. * DATEDIF
462. *
463. * @param long $startDate Excel date serial value or a standard date string
464. * @param long $endDate Excel date serial value or a standard date string
465. * @param string $unit
466. * @return long Interval between the dates
467. */
468. public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') {
469. $startDate = PHPExcel_Calculation_Functions:: flattenSingleValue($startDate);
470. $endDate = PHPExcel_Calculation_Functions:: flattenSingleValue($endDate);
471. $unit = strtoupper( PHPExcel_Calculation_Functions:: flattenSingleValue($unit));
473. if ( is_string($startDate = self::_getDateValue($startDate))) {
474. return PHPExcel_Calculation_Functions:: VALUE();
475. }
476. if ( is_string($endDate = self::_getDateValue($endDate))) {
477. return PHPExcel_Calculation_Functions:: VALUE();
478. }
480. // Validate parameters
481. if ($startDate >= $endDate) {
482. return PHPExcel_Calculation_Functions:: NaN();
483. }
485. // Execute function
486. $difference = $endDate - $startDate;
488. $PHPStartDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($startDate);
489. $startDays = $PHPStartDateObject->format('j');
490. $startMonths = $PHPStartDateObject->format('n');
491. $startYears = $PHPStartDateObject->format('Y');
493. $PHPEndDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($endDate);
494. $endDays = $PHPEndDateObject->format('j');
495. $endMonths = $PHPEndDateObject->format('n');
496. $endYears = $PHPEndDateObject->format('Y');
498. $retVal = PHPExcel_Calculation_Functions:: NaN();
499. switch ($unit) {
500. case 'D':
501. $retVal = intval($difference);
502. break;
503. case 'M':
504. $retVal = intval($endMonths - $startMonths) + ( intval($endYears - $startYears) * 12);
505. // We're only interested in full months
506. if ($endDays < $startDays) {
507. --$retVal;
508. }
509. break;
510. case 'Y':
511. $retVal = intval($endYears - $startYears);
512. // We're only interested in full months
513. if ($endMonths < $startMonths) {
514. --$retVal;
515. } elseif (($endMonths == $startMonths) && ($endDays < $startDays)) {
516. --$retVal;
517. }
518. break;
519. case 'MD':
520. if ($endDays < $startDays) {
521. $retVal = $endDays;
522. $PHPEndDateObject->modify('-'.$endDays.' days');
523. $adjustDays = $PHPEndDateObject->format('j');
524. if ($adjustDays > $startDays) {
525. $retVal += ($adjustDays - $startDays);
526. }
527. } else {
528. $retVal = $endDays - $startDays;
529. }
530. break;
531. case 'YM':
532. $retVal = intval($endMonths - $startMonths);
533. if ($retVal < 0) $retVal = 12 + $retVal;
534. // We're only interested in full months
535. if ($endDays < $startDays) {
536. --$retVal;
537. }
538. break;
539. case 'YD':
540. $retVal = intval($difference);
541. if ($endYears > $startYears) {
542. while ($endYears > $startYears) {
543. $PHPEndDateObject->modify('-1 year');
544. $endYears = $PHPEndDateObject->format('Y');
545. }
546. $retVal = $PHPEndDateObject->format('z') - $PHPStartDateObject->format('z');
547. if ($retVal < 0) { $retVal += 365; }
548. }
549. break;
550. }
551. return $retVal;
552. } // function DATEDIF()
555. /**
556. * DAYS360
557. *
558. * @param long $startDate Excel date serial value or a standard date string
559. * @param long $endDate Excel date serial value or a standard date string
560. * @param boolean $method US or European Method
561. * @return long PHP date/time serial
562. */
563. public static function DAYS360($startDate = 0, $endDate = 0, $method = false) {
564. $startDate = PHPExcel_Calculation_Functions:: flattenSingleValue($startDate);
565. $endDate = PHPExcel_Calculation_Functions:: flattenSingleValue($endDate);
567. if ( is_string($startDate = self::_getDateValue($startDate))) {
568. return PHPExcel_Calculation_Functions:: VALUE();
569. }
570. if ( is_string($endDate = self::_getDateValue($endDate))) {
571. return PHPExcel_Calculation_Functions:: VALUE();
572. }
574. // Execute function
575. $PHPStartDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($startDate);
576. $startDay = $PHPStartDateObject->format('j');
577. $startMonth = $PHPStartDateObject->format('n');
578. $startYear = $PHPStartDateObject->format('Y');
580. $PHPEndDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($endDate);
581. $endDay = $PHPEndDateObject->format('j');
582. $endMonth = $PHPEndDateObject->format('n');
583. $endYear = $PHPEndDateObject->format('Y');
585. return self::_dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, !$method);
586. } // function DAYS360()
589. /**
590. * YEARFRAC
591. *
592. * Calculates the fraction of the year represented by the number of whole days between two dates (the start_date and the
593. * end_date). Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or obligations
594. * to assign to a specific term.
595. *
596. * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer) or date object, or a standard date string
597. * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer) or date object, or a standard date string
598. * @param integer $method Method used for the calculation
599. * 0 or omitted US (NASD) 30/360
600. * 1 Actual/actual
601. * 2 Actual/360
602. * 3 Actual/365
603. * 4 European 30/360
604. * @return float fraction of the year
605. */
606. public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) {
607. $startDate = PHPExcel_Calculation_Functions:: flattenSingleValue($startDate);
608. $endDate = PHPExcel_Calculation_Functions:: flattenSingleValue($endDate);
609. $method = PHPExcel_Calculation_Functions:: flattenSingleValue($method);
611. if ( is_string($startDate = self::_getDateValue($startDate))) {
612. return PHPExcel_Calculation_Functions:: VALUE();
613. }
614. if ( is_string($endDate = self::_getDateValue($endDate))) {
615. return PHPExcel_Calculation_Functions:: VALUE();
616. }
618. if ((( is_numeric($method)) && (! is_string($method))) || ($method == '')) {
619. switch($method) {
620. case 0 :
621. return self:: DAYS360($startDate,$endDate) / 360;
622. break;
623. case 1 :
624. $days = self:: DATEDIF($startDate,$endDate);
625. $startYear = self:: YEAR($startDate);
626. $endYear = self:: YEAR($endDate);
627. $years = $endYear - $startYear + 1;
628. $leapDays = 0;
629. if ($years == 1) {
630. if (self::_isLeapYear($endYear)) {
631. $startMonth = self:: MONTHOFYEAR($startDate);
632. $endMonth = self:: MONTHOFYEAR($endDate);
633. $endDay = self:: DAYOFMONTH($endDate);
634. if (($startMonth < 3) ||
635. (($endMonth * 100 + $endDay) >= (2 * 100 + 29))) {
636. $leapDays += 1;
637. }
638. }
639. } else {
640. for($year = $startYear; $year <= $endYear; ++$year) {
641. if ($year == $startYear) {
642. $startMonth = self:: MONTHOFYEAR($startDate);
643. $startDay = self:: DAYOFMONTH($startDate);
644. if ($startMonth < 3) {
645. $leapDays += (self::_isLeapYear($year)) ? 1 : 0;
646. }
647. } elseif($year == $endYear) {
648. $endMonth = self:: MONTHOFYEAR($endDate);
649. $endDay = self:: DAYOFMONTH($endDate);
650. if (($endMonth * 100 + $endDay) >= (2 * 100 + 29)) {
651. $leapDays += (self::_isLeapYear($year)) ? 1 : 0;
652. }
653. } else {
654. $leapDays += (self::_isLeapYear($year)) ? 1 : 0;
655. }
656. }
657. if ($years == 2) {
658. if (($leapDays == 0) && (self::_isLeapYear($startYear)) && ($days > 365)) {
659. $leapDays = 1;
660. } elseif ($days < 366) {
661. $years = 1;
662. }
663. }
664. $leapDays /= $years;
665. }
666. return $days / (365 + $leapDays);
667. break;
668. case 2 :
669. return self:: DATEDIF($startDate,$endDate) / 360;
670. break;
671. case 3 :
672. return self:: DATEDIF($startDate,$endDate) / 365;
673. break;
674. case 4 :
675. return self:: DAYS360($startDate,$endDate,True) / 360;
676. break;
677. }
678. }
679. return PHPExcel_Calculation_Functions:: VALUE();
680. } // function YEARFRAC()
683. /**
684. * NETWORKDAYS
685. *
686. * @param mixed Start date
687. * @param mixed End date
688. * @param array of mixed Optional Date Series
689. * @return long Interval between the dates
690. */
691. public static function NETWORKDAYS($startDate,$endDate) {
692. // Retrieve the mandatory start and end date that are referenced in the function definition
693. $startDate = PHPExcel_Calculation_Functions:: flattenSingleValue($startDate);
694. $endDate = PHPExcel_Calculation_Functions:: flattenSingleValue($endDate);
695. // Flush the mandatory start and end date that are referenced in the function definition, and get the optional days
696. $dateArgs = PHPExcel_Calculation_Functions:: flattenArray( func_get_args());
697. array_shift($dateArgs);
698. array_shift($dateArgs);
700. // Validate the start and end dates
701. if ( is_string($startDate = $sDate = self::_getDateValue($startDate))) {
702. return PHPExcel_Calculation_Functions:: VALUE();
703. }
704. $startDate = (float) floor($startDate);
705. if ( is_string($endDate = $eDate = self::_getDateValue($endDate))) {
706. return PHPExcel_Calculation_Functions:: VALUE();
707. }
708. $endDate = (float) floor($endDate);
710. if ($sDate > $eDate) {
711. $startDate = $eDate;
712. $endDate = $sDate;
713. }
715. // Execute function
716. $startDoW = 6 - self:: DAYOFWEEK($startDate,2);
717. if ($startDoW < 0) { $startDoW = 0; }
718. $endDoW = self:: DAYOFWEEK($endDate,2);
719. if ($endDoW >= 6) { $endDoW = 0; }
721. $wholeWeekDays = floor(($endDate - $startDate) / 7) * 5;
722. $partWeekDays = $endDoW + $startDoW;
723. if ($partWeekDays > 5) {
724. $partWeekDays -= 5;
725. }
727. // Test any extra holiday parameters
728. $holidayCountedArray = array();
729. foreach ($dateArgs as $holidayDate) {
730. if ( is_string($holidayDate = self::_getDateValue($holidayDate))) {
731. return PHPExcel_Calculation_Functions:: VALUE();
732. }
733. if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
734. if ((self:: DAYOFWEEK($holidayDate,2) < 6) && (! in_array($holidayDate,$holidayCountedArray))) {
735. --$partWeekDays;
736. $holidayCountedArray[] = $holidayDate;
737. }
738. }
739. }
741. if ($sDate > $eDate) {
742. return 0 - ($wholeWeekDays + $partWeekDays);
743. }
744. return $wholeWeekDays + $partWeekDays;
745. } // function NETWORKDAYS()
748. /**
749. * WORKDAY
750. *
751. * @param mixed Start date
752. * @param mixed number of days for adjustment
753. * @param array of mixed Optional Date Series
754. * @return long Interval between the dates
755. */
756. public static function WORKDAY($startDate,$endDays) {
757. // Retrieve the mandatory start date and days that are referenced in the function definition
758. $startDate = PHPExcel_Calculation_Functions:: flattenSingleValue($startDate);
759. $endDays = (int) PHPExcel_Calculation_Functions:: flattenSingleValue($endDays);
760. // Flush the mandatory start date and days that are referenced in the function definition, and get the optional days
761. $dateArgs = PHPExcel_Calculation_Functions:: flattenArray( func_get_args());
762. array_shift($dateArgs);
763. array_shift($dateArgs);
765. if (( is_string($startDate = self::_getDateValue($startDate))) || (! is_numeric($endDays))) {
766. return PHPExcel_Calculation_Functions:: VALUE();
767. }
768. $startDate = (float) floor($startDate);
769. // If endDays is 0, we always return startDate
770. if ($endDays == 0) { return $startDate; }
772. $decrementing = ($endDays < 0) ? True : False;
774. // Adjust the start date if it falls over a weekend
776. $startDoW = self:: DAYOFWEEK($startDate,3);
777. if (self:: DAYOFWEEK($startDate,3) >= 5) {
778. $startDate += ($decrementing) ? -$startDoW + 4: 7 - $startDoW;
779. ($decrementing) ? $endDays++ : $endDays--;
780. }
782. // Add endDays
783. $endDate = (float) $startDate + ( intval($endDays / 5) * 7) + ($endDays % 5);
785. // Adjust the calculated end date if it falls over a weekend
786. $endDoW = self:: DAYOFWEEK($endDate,3);
787. if ($endDoW >= 5) {
788. $endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW;
789. }
791. // Test any extra holiday parameters
792. if ( count($dateArgs) > 0) {
793. $holidayCountedArray = $holidayDates = array();
794. foreach ($dateArgs as $holidayDate) {
795. if ((! is_null($holidayDate)) && ( trim($holidayDate) > '')) {
796. if ( is_string($holidayDate = self::_getDateValue($holidayDate))) {
797. return PHPExcel_Calculation_Functions:: VALUE();
798. }
799. if (self:: DAYOFWEEK($holidayDate,3) < 5) {
800. $holidayDates[] = $holidayDate;
801. }
802. }
803. }
804. if ($decrementing) {
805. rsort($holidayDates, SORT_NUMERIC);
806. } else {
807. sort($holidayDates, SORT_NUMERIC);
808. }
809. foreach ($holidayDates as $holidayDate) {
810. if ($decrementing) {
811. if (($holidayDate <= $startDate) && ($holidayDate >= $endDate)) {
812. if (! in_array($holidayDate,$holidayCountedArray)) {
813. --$endDate;
814. $holidayCountedArray[] = $holidayDate;
815. }
816. }
817. } else {
818. if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
819. if (! in_array($holidayDate,$holidayCountedArray)) {
820. ++$endDate;
821. $holidayCountedArray[] = $holidayDate;
822. }
823. }
824. }
825. // Adjust the calculated end date if it falls over a weekend
826. $endDoW = self:: DAYOFWEEK($endDate,3);
827. if ($endDoW >= 5) {
828. $endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW;
829. }
831. }
832. }
834. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
835. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
836. return (float) $endDate;
837. break;
838. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
839. return (integer) PHPExcel_Shared_Date:: ExcelToPHP($endDate);
840. break;
841. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
842. return PHPExcel_Shared_Date:: ExcelToPHPObject($endDate);
843. break;
844. }
845. } // function WORKDAY()
848. /**
849. * DAYOFMONTH
850. *
851. * @param long $dateValue Excel date serial value or a standard date string
852. * @return int Day
853. */
854. public static function DAYOFMONTH($dateValue = 1) {
855. $dateValue = PHPExcel_Calculation_Functions:: flattenSingleValue($dateValue);
857. if ( is_string($dateValue = self::_getDateValue($dateValue))) {
858. return PHPExcel_Calculation_Functions:: VALUE();
859. } elseif ($dateValue == 0.0) {
860. return 0;
861. } elseif ($dateValue < 0.0) {
862. return PHPExcel_Calculation_Functions:: NaN();
863. }
865. // Execute function
866. $PHPDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($dateValue);
868. return (int) $PHPDateObject->format('j');
869. } // function DAYOFMONTH()
872. /**
873. * DAYOFWEEK
874. *
875. * @param long $dateValue Excel date serial value or a standard date string
876. * @return int Day
877. */
878. public static function DAYOFWEEK($dateValue = 1, $style = 1) {
879. $dateValue = PHPExcel_Calculation_Functions:: flattenSingleValue($dateValue);
880. $style = floor( PHPExcel_Calculation_Functions:: flattenSingleValue($style));
882. if ( is_string($dateValue = self::_getDateValue($dateValue))) {
883. return PHPExcel_Calculation_Functions:: VALUE();
884. } elseif ($dateValue < 0.0) {
885. return PHPExcel_Calculation_Functions:: NaN();
886. }
888. // Execute function
889. $PHPDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($dateValue);
890. $DoW = $PHPDateObject->format('w');
892. $firstDay = 1;
893. switch ($style) {
894. case 1: ++$DoW;
895. break;
896. case 2: if ($DoW == 0) { $DoW = 7; }
897. break;
898. case 3: if ($DoW == 0) { $DoW = 7; }
899. $firstDay = 0;
900. --$DoW;
901. break;
902. default:
903. }
904. if ( PHPExcel_Calculation_Functions:: getCompatibilityMode() == PHPExcel_Calculation_Functions:: COMPATIBILITY_EXCEL) {
905. // Test for Excel's 1900 leap year, and introduce the error as required
906. if (($PHPDateObject->format('Y') == 1900) && ($PHPDateObject->format('n') <= 2)) {
907. --$DoW;
908. if ($DoW < $firstDay) {
909. $DoW += 7;
910. }
911. }
912. }
914. return (int) $DoW;
915. } // function DAYOFWEEK()
918. /**
919. * WEEKOFYEAR
920. *
921. * @param long $dateValue Excel date serial value or a standard date string
922. * @param boolean $method Week begins on Sunday or Monday
923. * @return int Week Number
924. */
925. public static function WEEKOFYEAR($dateValue = 1, $method = 1) {
926. $dateValue = PHPExcel_Calculation_Functions:: flattenSingleValue($dateValue);
927. $method = floor( PHPExcel_Calculation_Functions:: flattenSingleValue($method));
929. if (! is_numeric($method)) {
930. return PHPExcel_Calculation_Functions:: VALUE();
931. } elseif (($method < 1) || ($method > 2)) {
932. return PHPExcel_Calculation_Functions:: NaN();
933. }
935. if ( is_string($dateValue = self::_getDateValue($dateValue))) {
936. return PHPExcel_Calculation_Functions:: VALUE();
937. } elseif ($dateValue < 0.0) {
938. return PHPExcel_Calculation_Functions:: NaN();
939. }
941. // Execute function
942. $PHPDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($dateValue);
943. $dayOfYear = $PHPDateObject->format('z');
944. $dow = $PHPDateObject->format('w');
945. $PHPDateObject->modify('-'.$dayOfYear.' days');
946. $dow = $PHPDateObject->format('w');
947. $daysInFirstWeek = 7 - (($dow + (2 - $method)) % 7);
948. $dayOfYear -= $daysInFirstWeek;
949. $weekOfYear = ceil($dayOfYear / 7) + 1;
951. return (int) $weekOfYear;
952. } // function WEEKOFYEAR()
955. /**
956. * MONTHOFYEAR
957. *
958. * @param long $dateValue Excel date serial value or a standard date string
959. * @return int Month
960. */
961. public static function MONTHOFYEAR($dateValue = 1) {
962. $dateValue = PHPExcel_Calculation_Functions:: flattenSingleValue($dateValue);
964. if ( is_string($dateValue = self::_getDateValue($dateValue))) {
965. return PHPExcel_Calculation_Functions:: VALUE();
966. } elseif ($dateValue < 0.0) {
967. return PHPExcel_Calculation_Functions:: NaN();
968. }
970. // Execute function
971. $PHPDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($dateValue);
973. return (int) $PHPDateObject->format('n');
974. } // function MONTHOFYEAR()
977. /**
978. * YEAR
979. *
980. * @param long $dateValue Excel date serial value or a standard date string
981. * @return int Year
982. */
983. public static function YEAR($dateValue = 1) {
984. $dateValue = PHPExcel_Calculation_Functions:: flattenSingleValue($dateValue);
986. if ( is_string($dateValue = self::_getDateValue($dateValue))) {
987. return PHPExcel_Calculation_Functions:: VALUE();
988. } elseif ($dateValue < 0.0) {
989. return PHPExcel_Calculation_Functions:: NaN();
990. }
992. // Execute function
993. $PHPDateObject = PHPExcel_Shared_Date:: ExcelToPHPObject($dateValue);
995. return (int) $PHPDateObject->format('Y');
996. } // function YEAR()
999. /**
1000. * HOUROFDAY
1001. *
1002. * @param mixed $timeValue Excel time serial value or a standard time string
1003. * @return int Hour
1004. */
1005. public static function HOUROFDAY($timeValue = 0) {
1006. $timeValue = PHPExcel_Calculation_Functions:: flattenSingleValue($timeValue);
1008. if (! is_numeric($timeValue)) {
1009. if ( PHPExcel_Calculation_Functions:: getCompatibilityMode() == PHPExcel_Calculation_Functions:: COMPATIBILITY_GNUMERIC) {
1010. $testVal = strtok($timeValue,'/-: ');
1011. if ( strlen($testVal) < strlen($timeValue)) {
1012. return PHPExcel_Calculation_Functions:: VALUE();
1013. }
1014. }
1015. $timeValue = self::_getTimeValue($timeValue);
1016. if ( is_string($timeValue)) {
1017. return PHPExcel_Calculation_Functions:: VALUE();
1018. }
1019. }
1020. // Execute function
1021. if ($timeValue >= 1) {
1022. $timeValue = fmod($timeValue,1);
1023. } elseif ($timeValue < 0.0) {
1024. return PHPExcel_Calculation_Functions:: NaN();
1025. }
1026. $timeValue = PHPExcel_Shared_Date:: ExcelToPHP($timeValue);
1028. return (int) gmdate('G',$timeValue);
1029. } // function HOUROFDAY()
1032. /**
1033. * MINUTEOFHOUR
1034. *
1035. * @param long $timeValue Excel time serial value or a standard time string
1036. * @return int Minute
1037. */
1038. public static function MINUTEOFHOUR($timeValue = 0) {
1039. $timeValue = $timeTester = PHPExcel_Calculation_Functions:: flattenSingleValue($timeValue);
1041. if (! is_numeric($timeValue)) {
1042. if ( PHPExcel_Calculation_Functions:: getCompatibilityMode() == PHPExcel_Calculation_Functions:: COMPATIBILITY_GNUMERIC) {
1043. $testVal = strtok($timeValue,'/-: ');
1044. if ( strlen($testVal) < strlen($timeValue)) {
1045. return PHPExcel_Calculation_Functions:: VALUE();
1046. }
1047. }
1048. $timeValue = self::_getTimeValue($timeValue);
1049. if ( is_string($timeValue)) {
1050. return PHPExcel_Calculation_Functions:: VALUE();
1051. }
1052. }
1053. // Execute function
1054. if ($timeValue >= 1) {
1055. $timeValue = fmod($timeValue,1);
1056. } elseif ($timeValue < 0.0) {
1057. return PHPExcel_Calculation_Functions:: NaN();
1058. }
1059. $timeValue = PHPExcel_Shared_Date:: ExcelToPHP($timeValue);
1061. return (int) gmdate('i',$timeValue);
1062. } // function MINUTEOFHOUR()
1065. /**
1066. * SECONDOFMINUTE
1067. *
1068. * @param long $timeValue Excel time serial value or a standard time string
1069. * @return int Second
1070. */
1071. public static function SECONDOFMINUTE($timeValue = 0) {
1072. $timeValue = PHPExcel_Calculation_Functions:: flattenSingleValue($timeValue);
1074. if (! is_numeric($timeValue)) {
1075. if ( PHPExcel_Calculation_Functions:: getCompatibilityMode() == PHPExcel_Calculation_Functions:: COMPATIBILITY_GNUMERIC) {
1076. $testVal = strtok($timeValue,'/-: ');
1077. if ( strlen($testVal) < strlen($timeValue)) {
1078. return PHPExcel_Calculation_Functions:: VALUE();
1079. }
1080. }
1081. $timeValue = self::_getTimeValue($timeValue);
1082. if ( is_string($timeValue)) {
1083. return PHPExcel_Calculation_Functions:: VALUE();
1084. }
1085. }
1086. // Execute function
1087. if ($timeValue >= 1) {
1088. $timeValue = fmod($timeValue,1);
1089. } elseif ($timeValue < 0.0) {
1090. return PHPExcel_Calculation_Functions:: NaN();
1091. }
1092. $timeValue = PHPExcel_Shared_Date:: ExcelToPHP($timeValue);
1094. return (int) gmdate('s',$timeValue);
1095. } // function SECONDOFMINUTE()
1098. /**
1099. * EDATE
1100. *
1101. * Returns the serial number that represents the date that is the indicated number of months before or after a specified date
1102. * (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.
1103. *
1104. * @param long $dateValue Excel date serial value or a standard date string
1105. * @param int $adjustmentMonths Number of months to adjust by
1106. * @return long Excel date serial value
1107. */
1108. public static function EDATE($dateValue = 1, $adjustmentMonths = 0) {
1109. $dateValue = PHPExcel_Calculation_Functions:: flattenSingleValue($dateValue);
1110. $adjustmentMonths = floor( PHPExcel_Calculation_Functions:: flattenSingleValue($adjustmentMonths));
1112. if (! is_numeric($adjustmentMonths)) {
1113. return PHPExcel_Calculation_Functions:: VALUE();
1114. }
1116. if ( is_string($dateValue = self::_getDateValue($dateValue))) {
1117. return PHPExcel_Calculation_Functions:: VALUE();
1118. }
1120. // Execute function
1121. $PHPDateObject = self::_adjustDateByMonths($dateValue,$adjustmentMonths);
1123. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
1124. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
1125. return (float) PHPExcel_Shared_Date:: PHPToExcel($PHPDateObject);
1126. break;
1127. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
1128. return (integer) PHPExcel_Shared_Date:: ExcelToPHP( PHPExcel_Shared_Date:: PHPToExcel($PHPDateObject));
1129. break;
1130. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
1131. return $PHPDateObject;
1132. break;
1133. }
1134. } // function EDATE()
1137. /**
1138. * EOMONTH
1139. *
1140. * Returns the serial number for the last day of the month that is the indicated number of months before or after start_date.
1141. * Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
1142. *
1143. * @param long $dateValue Excel date serial value or a standard date string
1144. * @param int $adjustmentMonths Number of months to adjust by
1145. * @return long Excel date serial value
1146. */
1147. public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) {
1148. $dateValue = PHPExcel_Calculation_Functions:: flattenSingleValue($dateValue);
1149. $adjustmentMonths = floor( PHPExcel_Calculation_Functions:: flattenSingleValue($adjustmentMonths));
1151. if (! is_numeric($adjustmentMonths)) {
1152. return PHPExcel_Calculation_Functions:: VALUE();
1153. }
1155. if ( is_string($dateValue = self::_getDateValue($dateValue))) {
1156. return PHPExcel_Calculation_Functions:: VALUE();
1157. }
1159. // Execute function
1160. $PHPDateObject = self::_adjustDateByMonths($dateValue,$adjustmentMonths+1);
1161. $adjustDays = (int) $PHPDateObject->format('d');
1162. $adjustDaysString = '-'.$adjustDays.' days';
1163. $PHPDateObject->modify($adjustDaysString);
1165. switch ( PHPExcel_Calculation_Functions:: getReturnDateType()) {
1166. case PHPExcel_Calculation_Functions:: RETURNDATE_EXCEL :
1167. return (float) PHPExcel_Shared_Date:: PHPToExcel($PHPDateObject);
1168. break;
1169. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_NUMERIC :
1170. return (integer) PHPExcel_Shared_Date:: ExcelToPHP( PHPExcel_Shared_Date:: PHPToExcel($PHPDateObject));
1171. break;
1172. case PHPExcel_Calculation_Functions:: RETURNDATE_PHP_OBJECT :
1173. return $PHPDateObject;
1174. break;
1175. }
1176. } // function EOMONTH()
1178. } // class PHPExcel_Calculation_DateTime

Documentation generated on Sun, 27 Feb 2011 16:29:27 -0800 by phpDocumentor 1.4.3