Skip to main content
Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for 
Search instead for 
Did you mean: 
AleRods88
Contributor III
Contributor III

Get Next Friday from a Date

Hello,

I have a table with different dates in a field named DOC_DATE format MM/DD/YYYY.

What I need is to create a new field from DOC DATE, named PAY_DATE, with the next friday to that date.

So I should get something like the following:

DOC_DATEPAY_DATE
9/7/20209/11/2020
9/10/20209/11/2020
9/11/20209/11/2020
9/12/20209/18/2020
9/13/20209/18/2020
9/14/20209/18/2020
9/15/20209/18/2020

 

Is there any way to do that by script?

Thank you!!!

1 Solution

Accepted Solutions
Kushal_Chawda

@AleRods88  Assuming your Date Field are in proper date format. You can try below

date(if(WeekDay(DOC_DATE,0)=4,DOC_DATE, WeekEnd(DOC_DATE,0,4)+1)) as PAY_DATE

View solution in original post

2 Replies
Kushal_Chawda

@AleRods88  Assuming your Date Field are in proper date format. You can try below

date(if(WeekDay(DOC_DATE,0)=4,DOC_DATE, WeekEnd(DOC_DATE,0,4)+1)) as PAY_DATE
AleRods88
Contributor III
Contributor III
Author

Thank you very much! It worked!!!