how to get week number from assign activity
Like
First monday of date
second monday of date
third monday of date
thnks
shaik
how to get week number from assign activity
Like
First monday of date
second monday of date
third monday of date
thnks
shaik
@shaik.muktharvalli1
Can you eloberate your requirement
I have to get every first three week of monday date’s for every month
I have to get every first three week of monday date’s for every month
Try the below syntax:
Assign-> String.Join(vbCrLf, Enumerable.Range(1, 3).Select(Function(week) Enumerable.Range(1, 7).Select(Function(day) New DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddDays((day - CInt(New DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).DayOfWeek) + 7 * (week - 1)))).First().ToString("MM/dd/yyyy")).ToList())
Hope it helps!!
varibale type please
(From month In Enumerable.Range(1, 12)
Let firstDayOfMonth = New DateTime(Datetime.Now.Year, month, 1)
Let firstMonday = firstDayOfMonth.AddDays((DayOfWeek.Monday + 7 - firstDayOfMonth.DayOfWeek) Mod 7)
Select {firstMonday, firstMonday.AddDays(7), firstMonday.AddDays(14)}).SelectMany(Function(x) x).ToList()
Can you try the below
String.Join(",", Enumerable.Range(1, 12) _
.SelectMany(Function(month) Enumerable.Range(1, DateTime.DaysInMonth(DateTime.Now.Year, month)) _
.Where(Function(day) New DateTime(DateTime.Now.Year, month, day).DayOfWeek = DayOfWeek.Monday) _
.Take(3)) _
.Select(Function(day) day.ToString()))
Cheers!!
Please try this…this gives for current month …you can change it for any date you need
Enumerable.Range(1, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)).Select(Function(day) New DateTime(DateTime.Now.Year, DateTime.Now.Month, day)).Where(Function(d) d.DayOfWeek = DayOfWeek.Monday).Take(3).ToList() - this gives a list of dates

Hope this helps
cheers
Try This
This will generates a DataTable with two columns: “Month” and “Mondays”. In the “Mondays” column, it stores the first three Mondays of each month as strings
To get all the months use below syntax:
Assign-> Output = String.Join(Environment.NewLine, Enumerable.Range(1, 12).SelectMany(Function(month) Enumerable.Range(1, 3).Select(Function(week) Enumerable.Range(0, 7).Select(Function(day) New DateTime(DateTime.Today.Year, month, 1).AddDays((day + (week - 1) * 7) - CInt(New DateTime(DateTime.Today.Year, month, 1).DayOfWeek))).Where(Function(d) d.Month = month And d.DayOfWeek = DayOfWeek.Monday).FirstOrDefault())).Where(Function(d) d <> Nothing).Select(Function(d) d.ToString("MM/dd/yyyy")).ToList())
Output: System.String DataType
Hope it helps!!
I have to get first three monday date’s of month but 29 is january naa
please
Could you try this:
I think you need for all the months try this code:
Regards
how i can change each sheet name with this date’s
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.