How do I get the last day of the month with PowerShell?

green

Here’s how to programmatically get the last day of last month in PowerShell:

 

To get the last day of this month, this will work:

 green

2 Comments How do I get the last day of the month with PowerShell?

    1. Kamal

      Sure – if it’s just to display (and not for date-based calculations) just append something like:

      .tostring(“dd-MM-yyyy”)

      Or:

      .tostring(“yyyyMMdd”)

      You can format that pretty much anyway you want it to look.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *