Do you want to know how to format a date while working with PowerShell Get-Date? Here, I will show you how to use PowerShell Get-Date format to retrieve the current date and time, and format it in various ways. In this tutorial, we’ll explore how to use PowerShell Get-Date to format dates in different patterns, such as yyyymmdd, yyyymmddhhmmss, mm/dd/yyyy, and dd/mm/yyyy.
PowerShell Get-Date Format yyyymmdd
The yyyymmdd format is a common date representation that stands for a four-digit year, two-digit month, and two-digit day, all concatenated together without any separators.
In PowerShell, you can obtain the current date in yyyymmdd format using the Get-Date cmdlet with the -Format parameter:
Get-Date -Format "yyyyMMdd"
Example:
# This will output the current date as something like 20240104
$currentDate = Get-Date -Format "yyyyMMdd"
Write-Output $currentDate
You can see the output in the screenshot below after I executed the PowerShell script above.

Check out PowerShell Get-Date Minus 1 Day
PowerShell Get-Date Format yyyymmddhhmmss
If you need more than just the date and require the time as well, the yyyymmddhhmmss format comes into play. This pattern includes the year, month, day, hour, minute, and second, providing a complete timestamp without separators.
To format the current date and time in yyyymmddhhmmss format, use PowerShell Get-Date with the -Format parameter:
Get-Date -Format "yyyyMMddHHmmss"
Example:
# This will output the current date and time as something like 20240104153045
$currentDateTime = Get-Date -Format "yyyyMMddHHmmss"
Write-Output $currentDateTime
Here is the output like in the below screenshot.

Check out How To Check If File Modified In Last 24 Hours Using PowerShell?
PowerShell Format Date dd/mm/yyyy
The dd/mm/yyyy format is a widely used date representation around the world, where the day is followed by the month and then the year. To achieve this format in PowerShell, you again use the Get-Date cmdlet with the -Format parameter:
Get-Date -Format "dd/MM/yyyy"
Example:
# This will output the current date as something like 04/01/2024
$currentDateFormatted = Get-Date -Format "dd/MM/yyyy"
Write-Output $currentDateFormatted
To ensure that you get the dd/MM/yyyy format regardless of the regional settings, you can use the below PowerShell script.
$currentDateUSFormat = Get-Date -UFormat "%d/%M/%Y"
Write-Output $currentDateUSFormat
You can see the output in the below screenshot.

Read PowerShell Get-date Add Days Examples
PowerShell Format Date mm/dd/yyyy
The mm/dd/yyyy format is another common date representation, particularly in the United States, where the month precedes the day and year. To format a date in this style in PowerShell, you can use the Get-Date cmdlet with the -Format parameter, similar to the other formats we’ve discussed.
Here’s how you can get the current date in the mm/dd/yyyy format:
Get-Date -Format "MM/dd/yyyy"
Example:
# This will output the current date as something like 01/04/2024
$currentDateUSFormat = Get-Date -Format "MM/dd/yyyy"
Write-Output $currentDateUSFormat
In this example, the MM represents the two-digit month, dd represents the two-digit day, and yyyy represents the four-digit year. The slashes / are used as separators to distinguish each part of the date clearly.
To ensure that you get the mm/dd/yyyy format regardless of the regional settings, you can use the below PowerShell script.
$currentDateUSFormat = Get-Date -UFormat "%m/%d/%Y"
Write-Output $currentDateUSFormat
The -UFormat parameter uses Unix format specifiers and should give you the date in the desired format of mm/dd/yyyy. For example, if today’s date is January 4, 2024, the output should be 01/04/2024.
Check out the screenshot below for the output:

Conclusion
In this tutorial, I explained how to format dates with the PowerShell Get-Date cmdlet. By using the -Format parameter with the desired pattern in PowerShell Get-Date, you can easily transform the current date and time into a string that fits your needs.
I have explained the PowerShell get-date format examples below to you.
- PowerShell get-date format yyyymmdd
- PowerShell get-date format yyyymmddhhmmss
- PowerShell format date dd/mm/yyyy
- PowerShell Format Date mm/dd/yyyy
You may also like:
- How to Check If a Date Is Older Than 30 Days in PowerShell?
- How to Compare Dates in PowerShell?
- Get-ChildItem Sort By Date in PowerShell
- How to Get-Date Without Time in PowerShell?

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.