From 191bf214d95435a247c5c812a26aafe5f0d41d0d Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Tue, 21 Jan 2025 19:10:54 -0800 Subject: [PATCH] Fix 2 Samples Custom properties would be better in this context using j (no leading 0) rather than d (leading 0) for day of month. Properties has the same problem, and also needs backslashes before p to make it part of a tag. --- samples/Reading_workbook_data/Custom_properties.php | 2 +- samples/Reading_workbook_data/Properties.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/Reading_workbook_data/Custom_properties.php b/samples/Reading_workbook_data/Custom_properties.php index 26f7c33d06..1a84e73f2d 100644 --- a/samples/Reading_workbook_data/Custom_properties.php +++ b/samples/Reading_workbook_data/Custom_properties.php @@ -38,7 +38,7 @@ break; case 'd': // date - $propertyValue = is_numeric($propertyValue) ? date('l, d<\s\u\p>S F Y g:i A', (int) $propertyValue) : '*****INVALID*****'; + $propertyValue = is_numeric($propertyValue) ? date('l, j<\s\u\p>S F Y g:i A', (int) $propertyValue) : '*****INVALID*****'; $propertyType = 'date'; break; diff --git a/samples/Reading_workbook_data/Properties.php b/samples/Reading_workbook_data/Properties.php index a24a4967a8..441b12c9a5 100644 --- a/samples/Reading_workbook_data/Properties.php +++ b/samples/Reading_workbook_data/Properties.php @@ -19,7 +19,7 @@ // Read the Date when the workbook was created (as a PHP timestamp value) $creationDatestamp = $spreadsheet->getProperties()->getCreated(); -$creationDate = Date::formattedDateTimeFromTimestamp("$creationDatestamp", 'l, d<\s\up>S F Y'); +$creationDate = Date::formattedDateTimeFromTimestamp("$creationDatestamp", 'l, j<\s\u\p>S F Y'); $creationTime = Date::formattedDateTimeFromTimestamp("$creationDatestamp", 'g:i A'); $helper->log('Created On: ' . $creationDate . ' at ' . $creationTime); @@ -30,7 +30,7 @@ // Read the Date when the workbook was last modified (as a PHP timestamp value) $modifiedDatestamp = $spreadsheet->getProperties()->getModified(); // Format the date and time using the standard PHP date() function -$modifiedDate = Date::formattedDateTimeFromTimestamp("$modifiedDatestamp", 'l, d<\s\up>S F Y'); +$modifiedDate = Date::formattedDateTimeFromTimestamp("$modifiedDatestamp", 'l, j<\s\u\p>S F Y'); $modifiedTime = Date::formattedDateTimeFromTimestamp("$modifiedDatestamp", 'g:i A'); $helper->log('Last Modified On: ' . $modifiedDate . ' at ' . $modifiedTime);