0
Answered

I want to change the month in utl to subtract 1 from the current month

Craig V 10 years ago in BLOX CMS updated by Christine Masters 10 years ago 4
I am using this:
[% asset.starttime('Y, n, j, G, i, s') %]

and where the month # is (n) I want to subtract 1 from the #.

Example: [% asset.starttime('Y, n -1, j, G, i, s') %]

My example doesn't work and is just an example of what I want to happen.
Under review
Hi Craig! Can you provide a use case for this? I.E. what are you trying to do? There may be a better way to access the date through another method (like... getting the publish date of an asset, etc.)
Can you just use the Unix time and subtract 30 days? 

newdate = asset.starttime('U') - (30*3600);
echo newdate | datetime('Y, n, j, G, i, s'); 

It's not exactly one "month" but it's pretty close.
I was creating a block to show a timer on how much time is left to view the article before it goes behind the paywall. I figured this out with js. See right rail under the ad. http://www.buckscountycouriertimes.com/test/
Thanks.