@@ 1368-1393 (lines=26) @@ | ||
1365 | * |
|
1366 | * @return int Hour |
|
1367 | */ |
|
1368 | public static function HOUROFDAY($timeValue = 0) |
|
1369 | { |
|
1370 | $timeValue = Functions::flattenSingleValue($timeValue); |
|
1371 | ||
1372 | if (!is_numeric($timeValue)) { |
|
1373 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
|
1374 | $testVal = strtok($timeValue, '/-: '); |
|
1375 | if (strlen($testVal) < strlen($timeValue)) { |
|
1376 | return Functions::VALUE(); |
|
1377 | } |
|
1378 | } |
|
1379 | $timeValue = self::getTimeValue($timeValue); |
|
1380 | if (is_string($timeValue)) { |
|
1381 | return Functions::VALUE(); |
|
1382 | } |
|
1383 | } |
|
1384 | // Execute function |
|
1385 | if ($timeValue >= 1) { |
|
1386 | $timeValue = fmod($timeValue, 1); |
|
1387 | } elseif ($timeValue < 0.0) { |
|
1388 | return Functions::NAN(); |
|
1389 | } |
|
1390 | $timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue); |
|
1391 | ||
1392 | return (int) gmdate('G', $timeValue); |
|
1393 | } |
|
1394 | ||
1395 | /** |
|
1396 | * MINUTE. |
|
@@ 1409-1434 (lines=26) @@ | ||
1406 | * |
|
1407 | * @return int Minute |
|
1408 | */ |
|
1409 | public static function MINUTE($timeValue = 0) |
|
1410 | { |
|
1411 | $timeValue = $timeTester = Functions::flattenSingleValue($timeValue); |
|
1412 | ||
1413 | if (!is_numeric($timeValue)) { |
|
1414 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
|
1415 | $testVal = strtok($timeValue, '/-: '); |
|
1416 | if (strlen($testVal) < strlen($timeValue)) { |
|
1417 | return Functions::VALUE(); |
|
1418 | } |
|
1419 | } |
|
1420 | $timeValue = self::getTimeValue($timeValue); |
|
1421 | if (is_string($timeValue)) { |
|
1422 | return Functions::VALUE(); |
|
1423 | } |
|
1424 | } |
|
1425 | // Execute function |
|
1426 | if ($timeValue >= 1) { |
|
1427 | $timeValue = fmod($timeValue, 1); |
|
1428 | } elseif ($timeValue < 0.0) { |
|
1429 | return Functions::NAN(); |
|
1430 | } |
|
1431 | $timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue); |
|
1432 | ||
1433 | return (int) gmdate('i', $timeValue); |
|
1434 | } |
|
1435 | ||
1436 | /** |
|
1437 | * SECOND. |
|
@@ 1450-1475 (lines=26) @@ | ||
1447 | * |
|
1448 | * @return int Second |
|
1449 | */ |
|
1450 | public static function SECOND($timeValue = 0) |
|
1451 | { |
|
1452 | $timeValue = Functions::flattenSingleValue($timeValue); |
|
1453 | ||
1454 | if (!is_numeric($timeValue)) { |
|
1455 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
|
1456 | $testVal = strtok($timeValue, '/-: '); |
|
1457 | if (strlen($testVal) < strlen($timeValue)) { |
|
1458 | return Functions::VALUE(); |
|
1459 | } |
|
1460 | } |
|
1461 | $timeValue = self::getTimeValue($timeValue); |
|
1462 | if (is_string($timeValue)) { |
|
1463 | return Functions::VALUE(); |
|
1464 | } |
|
1465 | } |
|
1466 | // Execute function |
|
1467 | if ($timeValue >= 1) { |
|
1468 | $timeValue = fmod($timeValue, 1); |
|
1469 | } elseif ($timeValue < 0.0) { |
|
1470 | return Functions::NAN(); |
|
1471 | } |
|
1472 | $timeValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($timeValue); |
|
1473 | ||
1474 | return (int) gmdate('s', $timeValue); |
|
1475 | } |
|
1476 | ||
1477 | /** |
|
1478 | * EDATE. |