Expand my Community achievements bar.

SOLVED

QUERY: Find the first day of the current month and then add two months

Avatar

Level 1

Adobe Campaign Classic v7

QUERY: Find the first day of the current month and then add two months

Example:  Today: 11/22/2022   First Day of Month: 11/01/2022  Plus two months: 01/01/2023

 

My process has: checkDate before toDate(ToInteger(day of ToDate(current date) - 1) days before) + 2 month(s) in query window but does not work.

How do you write this query?

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hello,

 

To identify first day of the month, you can use the Function YearAndMonth(<Date>). After that you just have to add two months. So you'll have something like this:

 

AddMonths(YearAndMonth(GetDate()), 2)

 

I hope this helps you.

 

Best.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 2

Hello,

 

To identify first day of the month, you can use the Function YearAndMonth(<Date>). After that you just have to add two months. So you'll have something like this:

 

AddMonths(YearAndMonth(GetDate()), 2)

 

I hope this helps you.

 

Best.

Avatar

Community Advisor

Hi @TJFORCE68 

 

You can use the below code in your Query activity in advance selection :-

Day(DateOnly(GetDate())) - (Day(DateOnly(GetDate())) - 1 )+'/'+ Iif((Month(DateOnly(GetDate())) + 2) > 12, (Month(DateOnly(GetDate())) + 2) - 12 , (Month(DateOnly(GetDate())) + 2)) + '/' + Iif((Month(DateOnly(GetDate())) + 2) > 12, Year(DateOnly(GetDate())) +1 , Year(DateOnly(GetDate())))

 

Regards