Relative date keyword replacement


(gja) #1

Hi,

 

I'm attempting to use the  %globals_date_relative_<relative_date>% keyword replacement.  But it doesn't seem to work as suggested by the manual 

 

On a test page I have the following

 

%globals_date_d-m-Y%<br> Tomorrow:%globals_date_relative_tomorrow_Y-m-d%<br>

Yesterday:%globals_date_relative_yesterday_Y-m-d%<br>
This Friday:%globals_date_relative_this_friday_d-m-Y%.

 

But what is displayed on the screen is

14-01-2014
Tomorrow:Tue, 14 Jan 2014 13:36:10 +1300NZTuesdaypm3136vNZ_312014012014Tue, 14 Jan 2014 13:36:10 +1300Tue, 14 Jan 2014 13:36:10 +130020142_2014-01-14
Yesterday:Tue, 14 Jan 2014 13:36:10 +1300NZTuesdaypm3136vNZ_14NZ1031NZTue, 14 Jan 2014 13:36:10 +130014pm14_2014-01-14
This Friday:Tue, 14 Jan 2014 13:36:10 +1300NZTuesdaypm3136vNZ_31013610_fTue, 14 Jan 2014 13:36:10 +13003614pm14_14-01-2014.

 

All the dates are the same and appending the php date suffix doesn't seem to make a difference.

 

I'm wanting to get dates for yesterday and 6 months ago  or 180 days in the past. 

 

Is there a list of strings that are available for relative date?

 

Georgina.


(Bart Banda) #2

The tomorrow and yesterday modifiers won't work, you will need to use next_day and last_day, this_friday works for me though, but u can also try next_friday, here's what I get on a 4.18.0 system (today being 14-01-2014):

Tomorrow: %globals_date_relative_next_day_d-m-Y%<br>
Yesterday: %globals_date_relative_last_day_d-m-Y%<br>
This Friday: %globals_date_relative_this_friday_d-m-Y%<br>
Next Friday: %globals_date_relative_next_friday_d-m-Y%<br>

Prints:

Tomorrow: 15-01-2014
Yesterday: 13-01-2014
This Friday: 17-01-2014
Next Friday: 17-01-2014

(gja) #3

Alas for

 

Last Day:%globals_date_relative_last_day_d-m-Y%

 

I still get:

 

Last Day:Tue, 14 Jan 2014 14:53:30 +1300NZTuesdaypm3153vNZ_Tuesdaypm3031_14pm14_14-01-2014

 

 On  ver 4.10.4

 

Georgina.


(Bart Banda) #4

Ah that would be it, you are on an older version that doesn't support it. Was introduced in 4.16.0 :(


(gja) #5

Thanks, I'll look forward to using it after the next upgrade.

 

Where can I find a list of  modifiers that work in this context?

 

Georgina.


(Bart Banda) #6

The Squiz Matrix manuals is your best source for this stuff: http://manuals.matrix.squizsuite.net/concepts/appendices/keyword-modifiers/

 

You can also use the version selector to highlight which features and keywords work/do not work in your version. 


(Andrew Harris) #7

Really wanted to use this in an asset builder custom form layout, but the date_relative keyword does not seem to work in that situation, even though the standard %globals_date_l% does.

 

Am I doin' it rong?

 

v4.18.4


(Bart Banda) #8

What keyword are you trying to use it on?