3 weeks ago - last edited 3 weeks ago
I have a report that has data up to the end of previous calendar month. I want to email it, with the subject line saying "Report as of November 2024"
I can get December 2024 with this:
=today.in_time_zone("America/New_York").strftime(" %B %Y ")
But can't figure out how to subtract 1 month from it Where do I put "- 1.months" without a syntax error ?
Solved! Go to Solution.
3 weeks ago - last edited 3 weeks ago
Hi @dunncrew ,
As per the requirement you need always a month ago ( i.e. if current month December then requirement to get November). Please correct me.
in that case we can use directly "1.months.ago.in_time_zone("America/New_York").strftime(" %B %Y ")" to simply the solution.
Thanks and Regards,
Shivakumar K A
3 weeks ago
To stick with your current formula you can do this:
=(today - 1.months).in_time_zone("America/New_York").strftime(" %B %Y ")
3 weeks ago - last edited 3 weeks ago
Hi @dunncrew ,
As per the requirement you need always a month ago ( i.e. if current month December then requirement to get November). Please correct me.
in that case we can use directly "1.months.ago.in_time_zone("America/New_York").strftime(" %B %Y ")" to simply the solution.
Thanks and Regards,
Shivakumar K A
3 weeks ago
To stick with your current formula you can do this:
=(today - 1.months).in_time_zone("America/New_York").strftime(" %B %Y ")
3 weeks ago
Hi @gary1 ,
Using (1.months.ago) instead of (today - 1.months) simplifies the solution.
Thanks and Regards,
Shivakumar K A
3 weeks ago
There's a difference between answering the question and providing the simplest solution. I answered the question.