Hii Team,
How to find First Tuesday of Current Month
Example : This Months tuesday is on 03-10-2023
so we need to get that value as 3-10-2023
Thanks in advance
Hii Team,
How to find First Tuesday of Current Month
Example : This Months tuesday is on 03-10-2023
so we need to get that value as 3-10-2023
Thanks in advance
firstTuesday = (From i In Enumerable.Range(1, DateTime.DaysInMonth(currentDate.Year, currentDate.Month))
Let day = New DateTime(currentDate.Year, currentDate.Month, i)
Where day.DayOfWeek = DayOfWeek.Tuesday
Select day).FirstOrDefault()
OR
formattedFirstTuesday = firstTuesday.ToString(“d-M-yyyy”)
Hi @NISHITHA
Assign: CurrentDate = DateTime.Now
Assign: FirstDayOfMonth = New DateTime(CurrentDate.Year, CurrentDate.Month, 1)
Assign: FirstDayOfWeek = FirstDayOfMonth.DayOfWeek
Assign: DayToAdd = (2 - CInt(FirstDayOfWeek) + 7) Mod 7
Assign: FirstTuesday = FirstDayOfMonth.AddDays(DayToAdd).ToString("d-MM-yyyy")
BlankProcess11.zip (147.0 KB)
Hope this helps!!
Try This
CInt(If(dateJan1.DayOfWeek=0, 7, dateJan1.DayOfWeek))
create variable firsttuesday as data type is datetime
try this:
firstTuesday = DateTime.Now.AddDays((8 - CInt(DateTime.Now.DayOfWeek)) Mod 7)
cheers…!
Hi @NISHITHA ,
Could check with the below as well :
Enumerable.Range(1,7).Where(Function(x)Now.AddDays(-Now.Day+x).DayOfWeek.ToString.Equals("Tuesday")).Select(Function(x)Now.AddDays(-Now.Day+x)).First
Thanks @lrtetala its working
Thanks @supermanPunch for the approach
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.