
Contributor III
2020-09-14
10:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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_DATE | PAY_DATE |
9/7/2020 | 9/11/2020 |
9/10/2020 | 9/11/2020 |
9/11/2020 | 9/11/2020 |
9/12/2020 | 9/18/2020 |
9/13/2020 | 9/18/2020 |
9/14/2020 | 9/18/2020 |
9/15/2020 | 9/18/2020 |
Is there any way to do that by script?
Thank you!!!
1,379 Views
1 Solution
Accepted Solutions

MVP
2020-09-14
11:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
2 Replies

MVP
2020-09-14
11:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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

Contributor III
2020-09-14
11:32 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much! It worked!!!
1,340 Views
