How can I design a robot that prints all days from the first day of the month to the last day of the month (dd/MM/yyyy) except Saturday and Sunday? I dont want to see day of weekend.
Hi,
Do you need single string as result? If so, the following helps you.
String.Join(vbCrLf,Enumerable.Range(1,DateTime.DaysInMonth(targetDate.Year,targetDate.Month)).Select(Function(i) New DateTime(targetDate.Year,targetDate.Month,i)).Where(Function(d) d.DayOfWeek <>DayOfWeek.Sunday AndAlso d.DayOfWeek <>DayOfWeek.Saturday).Select(Function(d) d.ToString("dd/MM/yyyy")))
Regards,
1 Like
thank u it worked
1 Like
can u code list for startdate? for each item in writeline:
startdate
Hi,
Do you need list<String>
as result? The following might help you.
Enumerable.Range(1,DateTime.DaysInMonth(targetDate.Year,targetDate.Month)).Select(Function(i) New DateTime(targetDate.Year,targetDate.Month,i)).Where(Function(d) d.DayOfWeek <>DayOfWeek.Sunday AndAlso d.DayOfWeek <>DayOfWeek.Saturday).Select(Function(d) d.ToString("dd/MM/yyyy")).ToList
Regards,
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.