See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Calculation; 4 5 use DateTimeInterface; 6 7 /** 8 * @deprecated 1.18.0 9 */ 10 class DateTime 11 { 12 /** 13 * Identify if a year is a leap year or not. 14 * 15 * @Deprecated 1.18.0 16 * 17 * @See DateTimeExcel\Helpers::isLeapYear() 18 * Use the isLeapYear method in the DateTimeExcel\Helpers class instead 19 * 20 * @param int|string $year The year to test 21 * 22 * @return bool TRUE if the year is a leap year, otherwise FALSE 23 */ 24 public static function isLeapYear($year) 25 { 26 return DateTimeExcel\Helpers::isLeapYear($year); 27 } 28 29 /** 30 * getDateValue. 31 * 32 * @Deprecated 1.18.0 33 * 34 * @See DateTimeExcel\Helpers::getDateValue() 35 * Use the getDateValue method in the DateTimeExcel\Helpers class instead 36 * 37 * @param mixed $dateValue 38 * 39 * @return mixed Excel date/time serial value, or string if error 40 */ 41 public static function getDateValue($dateValue) 42 { 43 try { 44 return DateTimeExcel\Helpers::getDateValue($dateValue); 45 } catch (Exception $e) { 46 return $e->getMessage(); 47 } 48 } 49 50 /** 51 * DATETIMENOW. 52 * 53 * Returns the current date and time. 54 * The NOW function is useful when you need to display the current date and time on a worksheet or 55 * calculate a value based on the current date and time, and have that value updated each time you 56 * open the worksheet. 57 * 58 * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date 59 * and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. 60 * 61 * Excel Function: 62 * NOW() 63 * 64 * @Deprecated 1.18.0 65 * 66 * @See DateTimeExcel\Current::now() 67 * Use the now method in the DateTimeExcel\Current class instead 68 * 69 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 70 * depending on the value of the ReturnDateType flag 71 */ 72 public static function DATETIMENOW() 73 { 74 return DateTimeExcel\Current::now(); 75 } 76 77 /** 78 * DATENOW. 79 * 80 * Returns the current date. 81 * The NOW function is useful when you need to display the current date and time on a worksheet or 82 * calculate a value based on the current date and time, and have that value updated each time you 83 * open the worksheet. 84 * 85 * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date 86 * and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. 87 * 88 * Excel Function: 89 * TODAY() 90 * 91 * @Deprecated 1.18.0 92 * 93 * @See DateTimeExcel\Current::today() 94 * Use the today method in the DateTimeExcel\Current class instead 95 * 96 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 97 * depending on the value of the ReturnDateType flag 98 */ 99 public static function DATENOW() 100 { 101 return DateTimeExcel\Current::today(); 102 } 103 104 /** 105 * DATE. 106 * 107 * The DATE function returns a value that represents a particular date. 108 * 109 * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date 110 * format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. 111 * 112 * 113 * Excel Function: 114 * DATE(year,month,day) 115 * 116 * @Deprecated 1.18.0 117 * 118 * @See DateTimeExcel\Date::fromYMD() 119 * Use the fromYMD method in the DateTimeExcel\Date class instead 120 * 121 * PhpSpreadsheet is a lot more forgiving than MS Excel when passing non numeric values to this function. 122 * A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted, 123 * as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language. 124 * 125 * @param int $year The value of the year argument can include one to four digits. 126 * Excel interprets the year argument according to the configured 127 * date system: 1900 or 1904. 128 * If year is between 0 (zero) and 1899 (inclusive), Excel adds that 129 * value to 1900 to calculate the year. For example, DATE(108,1,2) 130 * returns January 2, 2008 (1900+108). 131 * If year is between 1900 and 9999 (inclusive), Excel uses that 132 * value as the year. For example, DATE(2008,1,2) returns January 2, 133 * 2008. 134 * If year is less than 0 or is 10000 or greater, Excel returns the 135 * #NUM! error value. 136 * @param int $month A positive or negative integer representing the month of the year 137 * from 1 to 12 (January to December). 138 * If month is greater than 12, month adds that number of months to 139 * the first month in the year specified. For example, DATE(2008,14,2) 140 * returns the serial number representing February 2, 2009. 141 * If month is less than 1, month subtracts the magnitude of that 142 * number of months, plus 1, from the first month in the year 143 * specified. For example, DATE(2008,-3,2) returns the serial number 144 * representing September 2, 2007. 145 * @param int $day A positive or negative integer representing the day of the month 146 * from 1 to 31. 147 * If day is greater than the number of days in the month specified, 148 * day adds that number of days to the first day in the month. For 149 * example, DATE(2008,1,35) returns the serial number representing 150 * February 4, 2008. 151 * If day is less than 1, day subtracts the magnitude that number of 152 * days, plus one, from the first day of the month specified. For 153 * example, DATE(2008,1,-15) returns the serial number representing 154 * December 16, 2007. 155 * 156 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 157 * depending on the value of the ReturnDateType flag 158 */ 159 public static function DATE($year = 0, $month = 1, $day = 1) 160 { 161 return DateTimeExcel\Date::fromYMD($year, $month, $day); 162 } 163 164 /** 165 * TIME. 166 * 167 * The TIME function returns a value that represents a particular time. 168 * 169 * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time 170 * format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. 171 * 172 * Excel Function: 173 * TIME(hour,minute,second) 174 * 175 * @Deprecated 1.18.0 176 * 177 * @See DateTimeExcel\Time::fromHMS() 178 * Use the fromHMS method in the DateTimeExcel\Time class instead 179 * 180 * @param int $hour A number from 0 (zero) to 32767 representing the hour. 181 * Any value greater than 23 will be divided by 24 and the remainder 182 * will be treated as the hour value. For example, TIME(27,0,0) = 183 * TIME(3,0,0) = .125 or 3:00 AM. 184 * @param int $minute A number from 0 to 32767 representing the minute. 185 * Any value greater than 59 will be converted to hours and minutes. 186 * For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM. 187 * @param int $second A number from 0 to 32767 representing the second. 188 * Any value greater than 59 will be converted to hours, minutes, 189 * and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 190 * or 12:33:20 AM 191 * 192 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 193 * depending on the value of the ReturnDateType flag 194 */ 195 public static function TIME($hour = 0, $minute = 0, $second = 0) 196 { 197 return DateTimeExcel\Time::fromHMS($hour, $minute, $second); 198 } 199 200 /** 201 * DATEVALUE. 202 * 203 * Returns a value that represents a particular date. 204 * Use DATEVALUE to convert a date represented by a text string to an Excel or PHP date/time stamp 205 * value. 206 * 207 * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date 208 * format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. 209 * 210 * Excel Function: 211 * DATEVALUE(dateValue) 212 * 213 * @Deprecated 1.18.0 214 * 215 * @See DateTimeExcel\DateValue::fromString() 216 * Use the fromString method in the DateTimeExcel\DateValue class instead 217 * 218 * @param string $dateValue Text that represents a date in a Microsoft Excel date format. 219 * For example, "1/30/2008" or "30-Jan-2008" are text strings within 220 * quotation marks that represent dates. Using the default date 221 * system in Excel for Windows, date_text must represent a date from 222 * January 1, 1900, to December 31, 9999. Using the default date 223 * system in Excel for the Macintosh, date_text must represent a date 224 * from January 1, 1904, to December 31, 9999. DATEVALUE returns the 225 * #VALUE! error value if date_text is out of this range. 226 * 227 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 228 * depending on the value of the ReturnDateType flag 229 */ 230 public static function DATEVALUE($dateValue) 231 { 232 return DateTimeExcel\DateValue::fromString($dateValue); 233 } 234 235 /** 236 * TIMEVALUE. 237 * 238 * Returns a value that represents a particular time. 239 * Use TIMEVALUE to convert a time represented by a text string to an Excel or PHP date/time stamp 240 * value. 241 * 242 * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time 243 * format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. 244 * 245 * Excel Function: 246 * TIMEVALUE(timeValue) 247 * 248 * @Deprecated 1.18.0 249 * 250 * @See DateTimeExcel\TimeValue::fromString() 251 * Use the fromString method in the DateTimeExcel\TimeValue class instead 252 * 253 * @param string $timeValue A text string that represents a time in any one of the Microsoft 254 * Excel time formats; for example, "6:45 PM" and "18:45" text strings 255 * within quotation marks that represent time. 256 * Date information in time_text is ignored. 257 * 258 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 259 * depending on the value of the ReturnDateType flag 260 */ 261 public static function TIMEVALUE($timeValue) 262 { 263 return DateTimeExcel\TimeValue::fromString($timeValue); 264 } 265 266 /** 267 * DATEDIF. 268 * 269 * Excel Function: 270 * DATEDIF(startdate, enddate, unit) 271 * 272 * @Deprecated 1.18.0 273 * 274 * @See DateTimeExcel\Difference::interval() 275 * Use the interval method in the DateTimeExcel\Difference class instead 276 * 277 * @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object 278 * or a standard date string 279 * @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object 280 * or a standard date string 281 * @param array|string $unit 282 * 283 * @return array|int|string Interval between the dates 284 */ 285 public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') 286 { 287 return DateTimeExcel\Difference::interval($startDate, $endDate, $unit); 288 } 289 290 /** 291 * DAYS. 292 * 293 * Returns the number of days between two dates 294 * 295 * Excel Function: 296 * DAYS(endDate, startDate) 297 * 298 * @Deprecated 1.18.0 299 * 300 * @See DateTimeExcel\Days::between() 301 * Use the between method in the DateTimeExcel\Days class instead 302 * 303 * @param array|DateTimeInterface|float|int|string $endDate Excel date serial value (float), 304 * PHP date timestamp (integer), PHP DateTime object, or a standard date string 305 * @param array|DateTimeInterface|float|int|string $startDate Excel date serial value (float), 306 * PHP date timestamp (integer), PHP DateTime object, or a standard date string 307 * 308 * @return array|int|string Number of days between start date and end date or an error 309 */ 310 public static function DAYS($endDate = 0, $startDate = 0) 311 { 312 return DateTimeExcel\Days::between($endDate, $startDate); 313 } 314 315 /** 316 * DAYS360. 317 * 318 * Returns the number of days between two dates based on a 360-day year (twelve 30-day months), 319 * which is used in some accounting calculations. Use this function to help compute payments if 320 * your accounting system is based on twelve 30-day months. 321 * 322 * Excel Function: 323 * DAYS360(startDate,endDate[,method]) 324 * 325 * @Deprecated 1.18.0 326 * 327 * @See DateTimeExcel\Days360::between() 328 * Use the between method in the DateTimeExcel\Days360 class instead 329 * 330 * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), 331 * PHP DateTime object, or a standard date string 332 * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), 333 * PHP DateTime object, or a standard date string 334 * @param array|bool $method US or European Method 335 * FALSE or omitted: U.S. (NASD) method. If the starting date is 336 * the last day of a month, it becomes equal to the 30th of the 337 * same month. If the ending date is the last day of a month and 338 * the starting date is earlier than the 30th of a month, the 339 * ending date becomes equal to the 1st of the next month; 340 * otherwise the ending date becomes equal to the 30th of the 341 * same month. 342 * TRUE: European method. Starting dates and ending dates that 343 * occur on the 31st of a month become equal to the 30th of the 344 * same month. 345 * 346 * @return array|int|string Number of days between start date and end date 347 */ 348 public static function DAYS360($startDate = 0, $endDate = 0, $method = false) 349 { 350 return DateTimeExcel\Days360::between($startDate, $endDate, $method); 351 } 352 353 /** 354 * YEARFRAC. 355 * 356 * Calculates the fraction of the year represented by the number of whole days between two dates 357 * (the start_date and the end_date). 358 * Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or 359 * obligations to assign to a specific term. 360 * 361 * Excel Function: 362 * YEARFRAC(startDate,endDate[,method]) 363 * 364 * @Deprecated 1.18.0 365 * 366 * @See DateTimeExcel\YearFrac::fraction() 367 * Use the fraction method in the DateTimeExcel\YearFrac class instead 368 * 369 * See https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html 370 * for description of algorithm used in Excel 371 * 372 * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), 373 * PHP DateTime object, or a standard date string 374 * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), 375 * PHP DateTime object, or a standard date string 376 * @param array|int $method Method used for the calculation 377 * 0 or omitted US (NASD) 30/360 378 * 1 Actual/actual 379 * 2 Actual/360 380 * 3 Actual/365 381 * 4 European 30/360 382 * 383 * @return array|float|string fraction of the year, or a string containing an error 384 */ 385 public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) 386 { 387 return DateTimeExcel\YearFrac::fraction($startDate, $endDate, $method); 388 } 389 390 /** 391 * NETWORKDAYS. 392 * 393 * Returns the number of whole working days between start_date and end_date. Working days 394 * exclude weekends and any dates identified in holidays. 395 * Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days 396 * worked during a specific term. 397 * 398 * Excel Function: 399 * NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]]) 400 * 401 * @Deprecated 1.18.0 402 * 403 * @See DateTimeExcel\NetworkDays::count() 404 * Use the count method in the DateTimeExcel\NetworkDays class instead 405 * 406 * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), 407 * PHP DateTime object, or a standard date string 408 * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), 409 * PHP DateTime object, or a standard date string 410 * @param mixed $dateArgs 411 * 412 * @return array|int|string Interval between the dates 413 */ 414 public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs) 415 { 416 return DateTimeExcel\NetworkDays::count($startDate, $endDate, ...$dateArgs); 417 } 418 419 /** 420 * WORKDAY. 421 * 422 * Returns the date that is the indicated number of working days before or after a date (the 423 * starting date). Working days exclude weekends and any dates identified as holidays. 424 * Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected 425 * delivery times, or the number of days of work performed. 426 * 427 * Excel Function: 428 * WORKDAY(startDate,endDays[,holidays[,holiday[,...]]]) 429 * 430 * @Deprecated 1.18.0 431 * 432 * @See DateTimeExcel\WorkDay::date() 433 * Use the date method in the DateTimeExcel\WorkDay class instead 434 * 435 * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), 436 * PHP DateTime object, or a standard date string 437 * @param int $endDays The number of nonweekend and nonholiday days before or after 438 * startDate. A positive value for days yields a future date; a 439 * negative value yields a past date. 440 * @param mixed $dateArgs 441 * 442 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 443 * depending on the value of the ReturnDateType flag 444 */ 445 public static function WORKDAY($startDate, $endDays, ...$dateArgs) 446 { 447 return DateTimeExcel\WorkDay::date($startDate, $endDays, ...$dateArgs); 448 } 449 450 /** 451 * DAYOFMONTH. 452 * 453 * Returns the day of the month, for a specified date. The day is given as an integer 454 * ranging from 1 to 31. 455 * 456 * Excel Function: 457 * DAY(dateValue) 458 * 459 * @Deprecated 1.18.0 460 * 461 * @See DateTimeExcel\DateParts::day() 462 * Use the day method in the DateTimeExcel\DateParts class instead 463 * 464 * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), 465 * PHP DateTime object, or a standard date string 466 * 467 * @return array|int|string Day of the month 468 */ 469 public static function DAYOFMONTH($dateValue = 1) 470 { 471 return DateTimeExcel\DateParts::day($dateValue); 472 } 473 474 /** 475 * WEEKDAY. 476 * 477 * Returns the day of the week for a specified date. The day is given as an integer 478 * ranging from 0 to 7 (dependent on the requested style). 479 * 480 * Excel Function: 481 * WEEKDAY(dateValue[,style]) 482 * 483 * @Deprecated 1.18.0 484 * 485 * @See DateTimeExcel\Week::day() 486 * Use the day method in the DateTimeExcel\Week class instead 487 * 488 * @param float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer), 489 * PHP DateTime object, or a standard date string 490 * @param int $style A number that determines the type of return value 491 * 1 or omitted Numbers 1 (Sunday) through 7 (Saturday). 492 * 2 Numbers 1 (Monday) through 7 (Sunday). 493 * 3 Numbers 0 (Monday) through 6 (Sunday). 494 * 495 * @return array|int|string Day of the week value 496 */ 497 public static function WEEKDAY($dateValue = 1, $style = 1) 498 { 499 return DateTimeExcel\Week::day($dateValue, $style); 500 } 501 502 /** 503 * STARTWEEK_SUNDAY. 504 * 505 * @Deprecated 1.18.0 506 * 507 * @see Use DateTimeExcel\Constants\STARTWEEK_SUNDAY instead 508 */ 509 const STARTWEEK_SUNDAY = 1; 510 511 /** 512 * STARTWEEK_MONDAY. 513 * 514 * @Deprecated 1.18.0 515 * 516 * @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY instead 517 */ 518 const STARTWEEK_MONDAY = 2; 519 520 /** 521 * STARTWEEK_MONDAY_ALT. 522 * 523 * @Deprecated 1.18.0 524 * 525 * @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY_ALT instead 526 */ 527 const STARTWEEK_MONDAY_ALT = 11; 528 529 /** 530 * STARTWEEK_TUESDAY. 531 * 532 * @Deprecated 1.18.0 533 * 534 * @see Use DateTimeExcel\Constants\STARTWEEK_TUESDAY instead 535 */ 536 const STARTWEEK_TUESDAY = 12; 537 538 /** 539 * STARTWEEK_WEDNESDAY. 540 * 541 * @Deprecated 1.18.0 542 * 543 * @see Use DateTimeExcel\Constants\STARTWEEK_WEDNESDAY instead 544 */ 545 const STARTWEEK_WEDNESDAY = 13; 546 547 /** 548 * STARTWEEK_THURSDAY. 549 * 550 * @Deprecated 1.18.0 551 * 552 * @see Use DateTimeExcel\Constants\STARTWEEK_THURSDAY instead 553 */ 554 const STARTWEEK_THURSDAY = 14; 555 556 /** 557 * STARTWEEK_FRIDAY. 558 * 559 * @Deprecated 1.18.0 560 * 561 * @see Use DateTimeExcel\Constants\STARTWEEK_FRIDAY instead 562 */ 563 const STARTWEEK_FRIDAY = 15; 564 565 /** 566 * STARTWEEK_SATURDAY. 567 * 568 * @Deprecated 1.18.0 569 * 570 * @see Use DateTimeExcel\Constants\STARTWEEK_SATURDAY instead 571 */ 572 const STARTWEEK_SATURDAY = 16; 573 574 /** 575 * STARTWEEK_SUNDAY_ALT. 576 * 577 * @Deprecated 1.18.0 578 * 579 * @see Use DateTimeExcel\Constants\STARTWEEK_SUNDAY_ALT instead 580 */ 581 const STARTWEEK_SUNDAY_ALT = 17; 582 583 /** 584 * DOW_SUNDAY. 585 * 586 * @Deprecated 1.18.0 587 * 588 * @see Use DateTimeExcel\Constants\DOW_SUNDAY instead 589 */ 590 const DOW_SUNDAY = 1; 591 592 /** 593 * DOW_MONDAY. 594 * 595 * @Deprecated 1.18.0 596 * 597 * @see Use DateTimeExcel\Constants\DOW_MONDAY instead 598 */ 599 const DOW_MONDAY = 2; 600 601 /** 602 * DOW_TUESDAY. 603 * 604 * @Deprecated 1.18.0 605 * 606 * @see Use DateTimeExcel\Constants\DOW_TUESDAY instead 607 */ 608 const DOW_TUESDAY = 3; 609 610 /** 611 * DOW_WEDNESDAY. 612 * 613 * @Deprecated 1.18.0 614 * 615 * @see Use DateTimeExcel\Constants\DOW_WEDNESDAY instead 616 */ 617 const DOW_WEDNESDAY = 4; 618 619 /** 620 * DOW_THURSDAY. 621 * 622 * @Deprecated 1.18.0 623 * 624 * @see Use DateTimeExcel\Constants\DOW_THURSDAY instead 625 */ 626 const DOW_THURSDAY = 5; 627 628 /** 629 * DOW_FRIDAY. 630 * 631 * @Deprecated 1.18.0 632 * 633 * @see Use DateTimeExcel\Constants\DOW_FRIDAY instead 634 */ 635 const DOW_FRIDAY = 6; 636 637 /** 638 * DOW_SATURDAY. 639 * 640 * @Deprecated 1.18.0 641 * 642 * @see Use DateTimeExcel\Constants\DOW_SATURDAY instead 643 */ 644 const DOW_SATURDAY = 7; 645 646 /** 647 * STARTWEEK_MONDAY_ISO. 648 * 649 * @Deprecated 1.18.0 650 * 651 * @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY_ISO instead 652 */ 653 const STARTWEEK_MONDAY_ISO = 21; 654 655 /** 656 * METHODARR. 657 * 658 * @Deprecated 1.18.0 659 * 660 * @see Use DateTimeExcel\Constants\METHODARR instead 661 */ 662 const METHODARR = [ 663 self::STARTWEEK_SUNDAY => self::DOW_SUNDAY, 664 self::DOW_MONDAY, 665 self::STARTWEEK_MONDAY_ALT => self::DOW_MONDAY, 666 self::DOW_TUESDAY, 667 self::DOW_WEDNESDAY, 668 self::DOW_THURSDAY, 669 self::DOW_FRIDAY, 670 self::DOW_SATURDAY, 671 self::DOW_SUNDAY, 672 self::STARTWEEK_MONDAY_ISO => self::STARTWEEK_MONDAY_ISO, 673 ]; 674 675 /** 676 * WEEKNUM. 677 * 678 * Returns the week of the year for a specified date. 679 * The WEEKNUM function considers the week containing January 1 to be the first week of the year. 680 * However, there is a European standard that defines the first week as the one with the majority 681 * of days (four or more) falling in the new year. This means that for years in which there are 682 * three days or less in the first week of January, the WEEKNUM function returns week numbers 683 * that are incorrect according to the European standard. 684 * 685 * Excel Function: 686 * WEEKNUM(dateValue[,style]) 687 * 688 * @Deprecated 1.18.0 689 * 690 * @See DateTimeExcel\Week::number(() 691 * Use the number method in the DateTimeExcel\Week class instead 692 * 693 * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), 694 * PHP DateTime object, or a standard date string 695 * @param int $method Week begins on Sunday or Monday 696 * 1 or omitted Week begins on Sunday. 697 * 2 Week begins on Monday. 698 * 11 Week begins on Monday. 699 * 12 Week begins on Tuesday. 700 * 13 Week begins on Wednesday. 701 * 14 Week begins on Thursday. 702 * 15 Week begins on Friday. 703 * 16 Week begins on Saturday. 704 * 17 Week begins on Sunday. 705 * 21 ISO (Jan. 4 is week 1, begins on Monday). 706 * 707 * @return array|int|string Week Number 708 */ 709 public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY) 710 { 711 return DateTimeExcel\Week::number($dateValue, $method); 712 } 713 714 /** 715 * ISOWEEKNUM. 716 * 717 * Returns the ISO 8601 week number of the year for a specified date. 718 * 719 * Excel Function: 720 * ISOWEEKNUM(dateValue) 721 * 722 * @Deprecated 1.18.0 723 * 724 * @See DateTimeExcel\Week::isoWeekNumber() 725 * Use the isoWeekNumber method in the DateTimeExcel\Week class instead 726 * 727 * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), 728 * PHP DateTime object, or a standard date string 729 * 730 * @return array|int|string Week Number 731 */ 732 public static function ISOWEEKNUM($dateValue = 1) 733 { 734 return DateTimeExcel\Week::isoWeekNumber($dateValue); 735 } 736 737 /** 738 * MONTHOFYEAR. 739 * 740 * Returns the month of a date represented by a serial number. 741 * The month is given as an integer, ranging from 1 (January) to 12 (December). 742 * 743 * Excel Function: 744 * MONTH(dateValue) 745 * 746 * @Deprecated 1.18.0 747 * 748 * @See DateTimeExcel\DateParts::month() 749 * Use the month method in the DateTimeExcel\DateParts class instead 750 * 751 * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), 752 * PHP DateTime object, or a standard date string 753 * 754 * @return array|int|string Month of the year 755 */ 756 public static function MONTHOFYEAR($dateValue = 1) 757 { 758 return DateTimeExcel\DateParts::month($dateValue); 759 } 760 761 /** 762 * YEAR. 763 * 764 * Returns the year corresponding to a date. 765 * The year is returned as an integer in the range 1900-9999. 766 * 767 * Excel Function: 768 * YEAR(dateValue) 769 * 770 * @Deprecated 1.18.0 771 * 772 * @See DateTimeExcel\DateParts::year() 773 * Use the ear method in the DateTimeExcel\DateParts class instead 774 * 775 * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), 776 * PHP DateTime object, or a standard date string 777 * 778 * @return array|int|string Year 779 */ 780 public static function YEAR($dateValue = 1) 781 { 782 return DateTimeExcel\DateParts::year($dateValue); 783 } 784 785 /** 786 * HOUROFDAY. 787 * 788 * Returns the hour of a time value. 789 * The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). 790 * 791 * Excel Function: 792 * HOUR(timeValue) 793 * 794 * @Deprecated 1.18.0 795 * 796 * @See DateTimeExcel\TimeParts::hour() 797 * Use the hour method in the DateTimeExcel\TimeParts class instead 798 * 799 * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), 800 * PHP DateTime object, or a standard time string 801 * 802 * @return array|int|string Hour 803 */ 804 public static function HOUROFDAY($timeValue = 0) 805 { 806 return DateTimeExcel\TimeParts::hour($timeValue); 807 } 808 809 /** 810 * MINUTE. 811 * 812 * Returns the minutes of a time value. 813 * The minute is given as an integer, ranging from 0 to 59. 814 * 815 * Excel Function: 816 * MINUTE(timeValue) 817 * 818 * @Deprecated 1.18.0 819 * 820 * @See DateTimeExcel\TimeParts::minute() 821 * Use the minute method in the DateTimeExcel\TimeParts class instead 822 * 823 * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), 824 * PHP DateTime object, or a standard time string 825 * 826 * @return array|int|string Minute 827 */ 828 public static function MINUTE($timeValue = 0) 829 { 830 return DateTimeExcel\TimeParts::minute($timeValue); 831 } 832 833 /** 834 * SECOND. 835 * 836 * Returns the seconds of a time value. 837 * The second is given as an integer in the range 0 (zero) to 59. 838 * 839 * Excel Function: 840 * SECOND(timeValue) 841 * 842 * @Deprecated 1.18.0 843 * 844 * @See DateTimeExcel\TimeParts::second() 845 * Use the second method in the DateTimeExcel\TimeParts class instead 846 * 847 * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), 848 * PHP DateTime object, or a standard time string 849 * 850 * @return array|int|string Second 851 */ 852 public static function SECOND($timeValue = 0) 853 { 854 return DateTimeExcel\TimeParts::second($timeValue); 855 } 856 857 /** 858 * EDATE. 859 * 860 * Returns the serial number that represents the date that is the indicated number of months 861 * before or after a specified date (the start_date). 862 * Use EDATE to calculate maturity dates or due dates that fall on the same day of the month 863 * as the date of issue. 864 * 865 * Excel Function: 866 * EDATE(dateValue,adjustmentMonths) 867 * 868 * @Deprecated 1.18.0 869 * 870 * @See DateTimeExcel\Month::adjust() 871 * Use the adjust method in the DateTimeExcel\Edate class instead 872 * 873 * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), 874 * PHP DateTime object, or a standard date string 875 * @param int $adjustmentMonths The number of months before or after start_date. 876 * A positive value for months yields a future date; 877 * a negative value yields a past date. 878 * 879 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 880 * depending on the value of the ReturnDateType flag 881 */ 882 public static function EDATE($dateValue = 1, $adjustmentMonths = 0) 883 { 884 return DateTimeExcel\Month::adjust($dateValue, $adjustmentMonths); 885 } 886 887 /** 888 * EOMONTH. 889 * 890 * Returns the date value for the last day of the month that is the indicated number of months 891 * before or after start_date. 892 * Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month. 893 * 894 * Excel Function: 895 * EOMONTH(dateValue,adjustmentMonths) 896 * 897 * @Deprecated 1.18.0 898 * 899 * @See DateTimeExcel\Month::lastDay() 900 * Use the lastDay method in the DateTimeExcel\EoMonth class instead 901 * 902 * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), 903 * PHP DateTime object, or a standard date string 904 * @param int $adjustmentMonths The number of months before or after start_date. 905 * A positive value for months yields a future date; 906 * a negative value yields a past date. 907 * 908 * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, 909 * depending on the value of the ReturnDateType flag 910 */ 911 public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) 912 { 913 return DateTimeExcel\Month::lastDay($dateValue, $adjustmentMonths); 914 } 915 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body