@@ 545-549 (lines=5) @@ | ||
542 | } |
|
543 | } |
|
544 | ||
545 | if (preg_match('/^now$/i', $date)) { |
|
546 | $date = "CURRENT_TIMESTAMP"; |
|
547 | } elseif (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/i', $date)) { |
|
548 | $date = "'$date.000'"; |
|
549 | } |
|
550 | ||
551 | if ($format == '%U') { |
|
552 | return "DATEDIFF(s, '1970-01-01 00:00:00', DATEADD(hour, DATEDIFF(hour, GETDATE(), GETUTCDATE()), $date))"; |
|
@@ 623-627 (lines=5) @@ | ||
620 | user_error('datetimeIntervalClause(): invalid interval ' . $interval, E_USER_WARNING); |
|
621 | } |
|
622 | ||
623 | if (preg_match('/^now$/i', $date)) { |
|
624 | $date = "CURRENT_TIMESTAMP"; |
|
625 | } elseif (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/i', $date)) { |
|
626 | $date = "'$date'"; |
|
627 | } |
|
628 | ||
629 | return "CONVERT(VARCHAR, DATEADD(" . $trans[strtolower($matches[2])] . ", " . (int)$matches[1] . ", $date), 120)"; |
|
630 | } |
|
@@ 642-646 (lines=5) @@ | ||
639 | */ |
|
640 | public function datetimeDifferenceClause($date1, $date2) |
|
641 | { |
|
642 | if (preg_match('/^now$/i', $date1)) { |
|
643 | $date1 = "CURRENT_TIMESTAMP"; |
|
644 | } elseif (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/i', $date1)) { |
|
645 | $date1 = "'$date1'"; |
|
646 | } |
|
647 | ||
648 | if (preg_match('/^now$/i', $date2)) { |
|
649 | $date2 = "CURRENT_TIMESTAMP"; |
|
@@ 648-652 (lines=5) @@ | ||
645 | $date1 = "'$date1'"; |
|
646 | } |
|
647 | ||
648 | if (preg_match('/^now$/i', $date2)) { |
|
649 | $date2 = "CURRENT_TIMESTAMP"; |
|
650 | } elseif (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/i', $date2)) { |
|
651 | $date2 = "'$date2'"; |
|
652 | } |
|
653 | ||
654 | return "DATEDIFF(s, $date2, $date1)"; |
|
655 | } |