Skip to main content
Solved

Producing dates

  • February 4, 2020
  • 1 reply
  • 10 views

Hi there,

I am trying to calculate the four date fields related to the start and end of the current and previous regulatory year based on the current date. The regulatory year starts from 1st of April and ends on 31 March of next year. So in this way current regulatory year starts from 1st April 2019 and ends on 31 March 2020. Here is my logic :

Current_regulatory_year_start: @DateTimeFormat(@DateTimeFormat(@DateTimeAdd(@DateTimeNow(),-P9M),%Y%m)01,%Y%m%d)

Current_regulatory_year_end: @DateTimeFormat(@DateTimeFormat(@DateTimeAdd(@DateTimeNow(),P2M),%Y%m)31,%Y%m%d)

Previous-regulatory_year_start: @DateTimeFormat(@DateTimeFormat(@DateTimeAdd(@DateTimeNow(),-P21M),%Y%m)01,%Y%m%d)

Previous_regulatory_year_end: @DateTimeFormat(@DateTimeFormat(@DateTimeAdd(@DateTimeNow(),-P10M),%Y%m)31,%Y%m%d)

 

However, it does not produce the desired result. Current_reulatory_year_end and previous_regulatory_year_end produce null value, whereas the other two do not produce the right date. Could you please guide me where am I making the mistake?

 

Best answer by ebygomm

To get the current regulatory year you need to take away 3 months not 9

So current regulatory year start date would be

@DateTimeFormat(@DateTimeAdd(@DateTimeNow(),-P3M),%Y)0401

From there you can calculate all the other dates

0684Q00000ArKgPQAV.png

View original
Did this help you find an answer to your question?

1 reply

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • Best Answer
  • February 4, 2020

To get the current regulatory year you need to take away 3 months not 9

So current regulatory year start date would be

@DateTimeFormat(@DateTimeAdd(@DateTimeNow(),-P3M),%Y)0401

From there you can calculate all the other dates

0684Q00000ArKgPQAV.png


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings