Thank you Jan for your help, based on your code I have further modified the code as per below and it worked.
If(
DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))) == 6,
ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(3, 11, 0, 0))),
If(
DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))) == 7,
ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(2, 11, 0, 0))),
If(
DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))) == 1,
ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(1, 11, 0, 0))),
ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(1, 11, 0, 0)))
)
)
)
So it does more checks for Saturday and Sunday as well.
- If today is Friday (6): Adds 3 days to get to Monday.
- If today is Saturday (7): Adds 2 days to get to Monday.
- If today is Sunday (1): Adds 1 day to get to Monday.
- Otherwise: Adds 1 day for the next day, assuming it's a weekday.
------------------------------
Phaneendra Avatapalli
Client Support, Desktop Support
------------------------------
Original Message:
Sent: 10-25-2024 08:13
From: Jan Heinonen
Subject: Digital bot date
Hi,
It will return the day of week as an integer.
If you want to return the callback date in one expression the following should work
DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))) == 6 ?ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(3, 11, 0, 0))) :ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(1, 11, 0, 0)))
It will add 3 days (returning date for Monday) if it's Friday, otherwise it adds 1 day.
------------------------------
Jan Heinonen
Contact Center Specialist
GlobalConnect AB
------------------------------
Original Message:
Sent: 10-25-2024 01:26
From: Phaneendra Avatapalli
Subject: Digital bot date
Hi Jan,
Thank you for your reply, I got an error when I added this statement saying "Cannot convert expression from type Integer to required type of Date." Not sure if I need to add anything else.
Regards
Phaneendra
------------------------------
Phaneendra Avatapalli
Client Support, Desktop Support
Original Message:
Sent: 10-23-2024 04:36
From: Jan Heinonen
Subject: Digital bot date
Hi Phaneendra,
You can use DayOfWeek to find out what weekday it is so you know if you should add 1 or 3 days to the current datetime.
DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0))))
Returns
- Integer : Returns the day of week from the supplied DateTime as a value from 1 to 7. Sunday=1, Monday=2, Tuesday=3, Wednesday=4, Thursday=5, Friday=6, Saturday=7
------------------------------
Jan Heinonen
Contact Center Specialist
GlobalConnect AB
Original Message:
Sent: 10-22-2024 20:23
From: Phaneendra Avatapalli
Subject: Digital bot date
Hi Nicole, Yes it does work thank you so much for your help. Now I have to figure out how to configure so it knows the next business day. We are only open Monday to Friday so if someone does request for a callback on Saturday it should show the next business day which is a Monday.
------------------------------
Phaneendra Avatapalli
Client Support, Desktop Support
Original Message:
Sent: 10-22-2024 11:25
From: Nicole VanWie
Subject: Digital bot date
Hi Phaneendra. Could you use ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(1, 11, 0, 0))) to add a duration of 1 day and 11 hours to the UTC date? Would that give you the next business day?
------------------------------
Nicole VanWie
UC Engineer