Tag Archives: day of month

C# || How To Get First/Last Day Of The Week And The First/Last Day Of The Month

The following is a module with functions which demonstrates how to get the first and last day of the week, as well as how to get the first and last day of the month using C#.


1. First & Last Day Of Week

The example below demonstrates the use of ‘Utils.DateRange.GetWeekStartAndEnd‘ to get the first and last day of the week.

By default, the start of the week is set on Monday. This can be changed by setting the second parameter to any valid property contained in the System.DayOfWeek enum.


2. First & Last Day Of Month

The example below demonstrates the use of ‘Utils.DateRange.GetMonthStartAndEnd‘ to get the first and last day of the week.


3. Utils Namespace

The following is the Utils Namespace. Include this in your project to start using!


4. More Examples

Below are more examples demonstrating the use of the ‘Utils‘ Namespace. Don’t forget to include the module when running the examples!

QUICK NOTES:
The highlighted lines are sections of interest to look out for.

The code is heavily commented, so no further insight is necessary. If you have any questions, feel free to leave a comment below.

VB.NET || How To Get First/Last Day Of The Week And The First/Last Day Of The Month

The following is a module with functions which demonstrates how to get the first and last day of the week, as well as how to get the first and last day of the month using VB.NET.


1. First & Last Day Of Week

The example below demonstrates the use of ‘Utils.DateRange.GetWeekStartAndEnd‘ to get the first and last day of the week.

By default, the start of the week is set on Monday. This can be changed by setting the second parameter to any valid property contained in the Microsoft.VisualBasic.FirstDayOfWeek enum.


2. First & Last Day Of Month

The example below demonstrates the use of ‘Utils.DateRange.GetMonthStartAndEnd‘ to get the first and last day of the week.


3. Utils Namespace

The following is the Utils Namespace. Include this in your project to start using!


4. More Examples

Below are more examples demonstrating the use of the ‘Utils‘ Namespace. Don’t forget to include the module when running the examples!

QUICK NOTES:
The highlighted lines are sections of interest to look out for.

The code is heavily commented, so no further insight is necessary. If you have any questions, feel free to leave a comment below.