Archived topic
Show PDT On Articles During DST and PST Outside It
5 replies · Started by Jordan Levi on March 16, 2023
hey, so i want my website to show the timezone next to the day and time articles were posted and i finally figured out how to throw PST next to them, but i realized that we're actually in PDT now, so is there a way to keep the PST next to articles when they're posted outside of daylights savings and PDT next to articles when they're posted during it?
Hi Jordan,
How are you adding the Timezone currently?
You'll likely need a custom code for this.
i checked 'Custom' under Date Format in the general settings tab and put this in the box: F j, Y \a\t g:i A \P\S\T\
I see. It's a bit complicated and would be out of our scope of support.
Someone shared this code:
wp_add_inline_script(
'wp-date',
implode(
"\n",
array(
'var localDateSettings = wp.date.__experimentalGetSettings();',
'localDateSettings.formats.datetimeAbbreviated = "M j, Y g:i a T";',
'wp.date.setSettings(localDateSettings);',
)
),
'after'
);
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
You can then try adding this to your date Format: Y/m/d g:i a T
Not sure if it would work. It might be good to reach out to a developer regarding this.
hell yeah, it worked, thank you so much!
You're welcome, Jordan!