Skip to content

Commit 5e2a14a

Browse files
committed
Use Cake\I18n\DateTime for datetime formatting in BackupExport. Simplifies and modernizes date handling.
1 parent 7e36443 commit 5e2a14a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Utility/BackupExport.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
namespace DatabaseBackup\Utility;
1717

1818
use Cake\Datasource\ConnectionInterface;
19+
use Cake\I18n\DateTime;
1920
use DatabaseBackup\Compression;
2021
use DatabaseBackup\OperationType;
2122
use Symfony\Component\Filesystem\Exception\IOException;
@@ -73,7 +74,7 @@ protected function replaceFilenamePatterns(string $filename): string
7374
search: ['{$DATABASE}', '{$DATETIME}', '{$HOSTNAME}', '{$TIMESTAMP}'],
7475
replace: [
7576
$this->Connection->config()['database'],
76-
date('YmdHis'),
77+
new DateTime()->format('YmdHis'),
7778
str_replace(['127.0.0.1', '::1'], 'localhost', $this->Connection->config()['host'] ?? 'localhost'),
7879
(string)time(),
7980
],

0 commit comments

Comments
 (0)