How To Get FirstDay/Last of the Week/Month Using PowerShell

Dears,

How To Get FirstDay/Last of the Week/Month Using Power-Shell ? Thanks in Advance

Hi @hsendel,
I’m pretty sure that google is your friend in this case :wink: . Example:

1 Like

Perfect!!! Pablito :slight_smile:

Any similar commands for First/Last Day of the Week ?

1 Like

Any similar commands for First/Last Day of the Week ?

Anny Support for this?

Hi
I’m Pretty sure that Stackoverflow is your friend in this case :wink:

Could you please specify the exact code? I see a lot answers :slight_smile:

public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
{
    int diff = (7 + (dt.DayOfWeek - startOfWeek)) % 7;
    return dt.AddDays(-1 * diff).Date;
}

Got errors !!!

Just add the Package to your project
Datetime.Now.FirstDayOfWeek()
DateTime.Now.LastDayOfWeek()

Sorry I forgot it, it’s C# Code :sweat_smile:

1 Like

What about UiPath?

Get-ItemProperty -Path 'HKCU:\Control Panel\International'| Select-Object iFirstDayOfWeek

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.