Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-10-16 21:11:17

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Change the timestamps of each article by 8 hours

For usability in the admin interface, I have a site that I need to change the timestamps (posted, expiry and modified) on every article. This is to be done in conjunction with a timezone change in the preferences, the idea being that Textpattern is a new timezone and the articles have their timestamps bumped by the difference, so they cancel one another out.

The reasoning behind it is expiry dates. I am using more expiry dates in PDT, but I’m posting in GMT currently. Rather than mentally do the sums for timezone offsets, I figure the safest way is to switch the timezone and push the timestamps up. Is there a way I can do this at database or plugin level?

Thank you in advance.

Offline

#2 2012-10-18 09:41:20

etc
Developer
Registered: 2010-11-11
Posts: 5,397
Website GitHub

Re: Change the timestamps of each article by 8 hours

Hi Pete, if you need to do it for future articles too, maybe MySQL TRIGGER could help you?

Offline

#3 2012-10-18 10:39:21

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Change the timestamps of each article by 8 hours

Hi Pete, if you need to do for future or for posted, you can use mck_time plugin;

www.kreatore.it/txp/mck_time

For future
<txp:mck_time start="expires" time="8 hours" format="%H:%M" />

For posted
<txp:mck_time start="posted" time="8 hours" format="%H:%M" />

Last edited by MarcoK (2012-10-18 10:40:51)

Offline

#4 2012-10-18 10:49:46

etc
Developer
Registered: 2010-11-11
Posts: 5,397
Website GitHub

Re: Change the timestamps of each article by 8 hours

MarcoK wrote:

Hi Pete, if you need to do for future or for posted, you can use mck_time plugin

Interesting. But it does not really modify dates, right, so the articles will expire too early/late anyway?

Such a plugin would be much easier to write if you voted for my call :)

Offline

#5 2012-10-18 10:50:08

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Re: Change the timestamps of each article by 8 hours

etc wrote:

Hi Pete, if you need to do it for future articles too, maybe MySQL TRIGGER could help you?

Thanks, Oleg – good find, thank you. I think what I’m going to do is leave the timestamps as they are, but see if I can apply an offset to the posted output so I can kludge the output to the browser.

MarcoK write:

Hi Pete, if you need to do for future or for posted, you can use mck_time plugin;

Huh, that looks interesting, thank you — I will check it out!

Offline

#6 2012-10-18 11:03:21

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Change the timestamps of each article by 8 hours

etc wrote:

Interesting. But it does not really modify dates, right, so the articles will expire too early/late anyway?

Yeah! It will modify only the output date.

Offline

#7 2012-10-18 11:08:51

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Re: Change the timestamps of each article by 8 hours

MarcoK wrote:

Yeah! It will modify only the output date.

This is exactly what I’m looking for. Thanks, Marco.

Update: installed, implemented — working! I’ve credited you here, Marco, I hope that’s OK.

Last edited by gaekwad (2012-10-18 11:23:20)

Offline

#8 2012-10-30 18:20:48

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Change the timestamps of each article by 8 hours

Sure!!!

Thanks!

Offline

Board footer

Powered by FluxBB