From b58e4c786c981c3ee809a242cab6e72f9d993c77 Mon Sep 17 00:00:00 2001 From: filesite Date: Mon, 15 Jul 2024 08:51:40 +0800 Subject: [PATCH] improve date get from filename --- plugins/Common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Common.php b/plugins/Common.php index 55862bb..a64dd16 100644 --- a/plugins/Common.php +++ b/plugins/Common.php @@ -585,11 +585,11 @@ Class Common { $date = ''; try { - preg_match('/^.*(\d{4}[012]{2}\d{2}).*$/', $str, $matches); //尝试Y-m-d格式的日期 + preg_match('/^.*([1920]\d{3}[012][0-9][0123]\d).*$/U', $str, $matches); //尝试Y-m-d格式的日期 if (empty($matches[1])) { //再尝试单位秒的时间戳 - preg_match('/^.*(\d{10}).*$/', $str, $matches); + preg_match('/^.*(\d{10}).*$/U', $str, $matches); if (empty($matches[1])) { - preg_match('/^.*(\d{13}).*$/', $str, $matches); //单位毫秒的时间戳 + preg_match('/^.*(\d{13}).*$/U', $str, $matches); //单位毫秒的时间戳 if (!empty($matches[1])) { $date = date('Y-m-d', (int)$matches[1] / 1000); }