Date Expression

Hello Everyone, Hope you are doing good

I would like to present this post who are looking for the expressions related to the Date Expression

Get the Week Count

W"+System.Globalization.CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(Today,System.Globalization.CalendarWeekRule.FirstDay,DayOfWeek.Monday).ToString

image

Get the 5 Business days count

Enumerable.Range(0, new DateTime(2023,12,31).DayOfYear + 1).Select(Function (x) New DateTime(2023,1,1).AddDays(x)).Where(Function (x) Not (x.DayOfWeek = 0 OrElse x.DayOfWeek = 6 )).Count

image

Count of Completed Day (Monday)

System.Globalization.CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(Today.AddDays(-7),System.Globalization.CalendarWeekRule.FirstDay,DayOfWeek.Monday)

image

Get the previous month last Date of Monday

Enumerable.Range(-7,7).Select(Function(i) New DateTime(Today.Year,Today.Month,1).AddDays(i)).Where(Function(d) d.DayOfWeek=DayOfWeek.Monday).First()

image

Hope this will be helpful :slight_smile:

Questions

For questions on your retrieval case open a new topic and get individual support

Feedback

Click image button to share your thoughts

Regards
Gokul

9 Likes