• [today format=Y] returns the current year. I’d like to use the value in a loop (and using [calc]), but I can’t figure how. Is it possible:

    • 2019 It is 5 years since 2014
    • 2018 It is 4 years since 2014
    • 2017 It is 3 years since 2014
    • 2016 It is 2 years since 2014
    • 2015 It is 1 years since 2014
    • This topic was modified 5 years, 5 months ago by iantresman.
    • This topic was modified 5 years, 5 months ago by iantresman.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Not sure how you want to use it within a loop but maybe this will help – this returns the current year based on the date minus 2014:

    [set variable1]20[today format=y][/set]
    [get variable1]
    It is
    [calc][get variable1] – 2014[/calc]
    years since 2014.

    [today format=y] has the Y2K bug apparently ?? it only returns “19” – obviously you can also take the 20 out of both spots (20[today… and 2014) and have it subtract 19 – 14 = 5

    If you are looking to use in a loop somehow, post a bit of additional info –

    Hope this helps

    Thread Starter iantresman

    (@iantresman)

    That’s it, thank you! Had to tweak it slightly.

    [today format=y] produces 19,
    [today format=Y] produces 2019

    So the example script now reads:

    [set myyear][today format=Y][/set]
    Now is: [get myyear]
    It is [calc]myyear-2014[/calc] years since 2014. 
    • This reply was modified 5 years, 5 months ago by iantresman.

    Perfect – glad it helped!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Loop using the current year’ is closed to new replies.