How can I change the date?

I’d like to deal with the date as below, so please let me know how.
(Divide by 3 months.)

Ex)
Before the change :arrow_forward: After the change
2023.04.27 :arrow_forward: 2023.03.01
2023.05.08 :arrow_forward: 2023.03.01
2023.10.18 :arrow_forward: 2023.09.01
2023.02.04 :arrow_forward: 2022.12.01
2023.08.06 :arrow_forward: 2023.06.01

Hi @minth08

You should use the “Modify Date” Activity. This makes it extremely easy to adjust dates, find the first day of previous months etc.

Note: You can also add multiple “Modifications” in the same activity to reach your desired result (i.e. Modification 1 - first day of the month, Modification 2 - last month).

What’s more: There’s a “Test” button that let’s you directly see and validate if the output would be as intended.

Best regards
Roman

Hi @minth08 ,

You can use the following expression for getting the desired output:

if(Cint(Math.Floor(Cdate(“2023.02.04”).Month / 3) * 3).Equals(0),new DateTime(Cdate(“2023.02.04”).year-1,12,1).ToString(“yyyy.MM.dd”),new DateTime(Cdate(“2023.02.04”).year,Cint(Math.Floor(Cdate(“2023.02.04”).Month / 3) * 3),1).ToString(“yyyy.MM.dd”))

  • Replace the dates with your date

Hope this helps

Regards,

2 Likes

Hi @minth08,

Try this:

New DateTime(CDate(“2023.02.04”).AddMonths(-3).Year,Cint((Math.Ceiling((CDate(“2023.02.04”).AddMonths(-3).Month)/3)*3)),1).ToString(“yyyy.MM.dd”)

This satisfies all above examples.

Hope it helps.

Regards,
Harshith

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.