Skip to main content
Answer

How to get next Thursday date In GI?

  • May 21, 2024
  • 2 replies
  • 76 views

Forum|alt.badge.img+1

Hello Team

We have a requirement like get the next thursday date based on the current Date in GI. Tried in the SQL like below and it is working fine, Can you please provide Equivalent syntax in GI.

DECLARE in SQL @GivenDate DATE = '2024-05-15';  

SELECT DATEADD(DAY, (4 - DATEPART(WEEKDAY, @GivenDate) + 7) % 7, @GivenDate) AS NextThursday;

Could someone please help on this.

Thank you.

 

 

Best answer by lauraj46

Hi @saikrishnav35 ,

You should be able to use this formula:

=DATEADD(Today(), 'd', (5 - DayOfWeek(Today()) + 7) % 7)

Hope this helps!

Laura

2 replies

lauraj46
Captain II
Forum|alt.badge.img+8
  • Captain II
  • Answer
  • May 21, 2024

Hi @saikrishnav35 ,

You should be able to use this formula:

=DATEADD(Today(), 'd', (5 - DayOfWeek(Today()) + 7) % 7)

Hope this helps!

Laura


Forum|alt.badge.img+1
  • Author
  • Semi-Pro III
  • May 22, 2024

Hi @lauraj46 

It works perfectly. Thank you!