how to check today is the last sunday of the month or not
if last sunday then i need to send an mail how to do this
how to check today is the last sunday of the month or not
if last sunday then i need to send an mail how to do this
Hi @manoj2500,
Try the below code, it will give the last Sunday date Eg: 08/30/2020
DateTime lastSundayOfNextMonth = DateTime.Now
while(lastSundayOfNextMonth.DayOfWeek <> DayOfWeek.Sunday){
lastSundayOfNextMonth = lastSundayOfNextMonth.AddDays(1)
}
can you plzz share xaml as i am getting error trying this thing
Hi、
Can you try rhe following condition?
Let’s say, targetDate = Today
(targetDate.DayOfWeek=DayOfWeek.Sunday) AndAlso ((new Date(targetDate.Year,targetDate.Month,1).AddMonths(1)-targetDate).Days<=7)
Regards,
Try this xaml
Test.xaml (5.6 KB)
@Yoichi i have to use it like this
assign 1 targetdate (var)= Today
assign 2 targetdate (var)= (targetDate.DayOfWeek=DayOfWeek.Sunday) AndAlso ((new Date(targetDate.Year,targetDate.Month,1).AddMonths(1)-targetDate).Days<=7)
Hi,
How about the following?
td=Today
lastDayofMonth = new Date(td.Year,td.Month,1).AddMonths(1).AddDays(-1)
targetDate = lastDayofMonth.AddDays(-1*CInt(lastDayofMonth.DayOfWeek))
Regards,
@Yoichi can you please share a xaml i am facing error please
@aanandsanraj thanks it working can you help me one more thing i need to check if it same day than how can we check if current day maches the o/p of the above xaml
To check if it is in the same day use this:
DateTime.Now.DayOfWeek
Cheers!
Check this xaml Test.xaml (5.8 KB)