How to Get-Date Without Time in PowerShell?

Do you want to get-date without time in PowerShell? In this PowerShell tutorial, I will explain different “PowerShell get-date without time” methods with examples.

PowerShell get-date without time

Here are different ways to get-date without time in PowerShell.

Using Get-Date with DisplayHint Parameter

PowerShell provides the Get-Date cmdlet, which is a versatile command used to retrieve the current date and time. To get only the date part, you can make use of the -DisplayHint parameter.

$todayDate = Get-Date -DisplayHint Date

This PowerShell command will return the current date with the default date format, omitting the time portion.

Formatting the Date

If you need to format the date, PowerShell allows you to specify the format using the -Format parameter.

$todayDate = Get-Date -Format "yyyy-MM-dd"

This command will return the date in the format of year-month-day, for example, “2024-01-04”. It’s a string representation of the date, without any time information.

Once you run the code, you can see the output in the below screenshot.

How to Get-Date Without Time in PowerShell

Creating a DateTime Object with Today’s Date Only

Sometimes, you may need a [System.DateTime] object that contains today’s date without the time portion. To achieve this, you can use the Date property of the DateTime object returned by Get-Date in PowerShell.

$todayDate = (Get-Date).Date

This command will create a [System.DateTime] object with the time set to 00:00:00, effectively removing the time part but still leaving you with a DateTime object that can be used in date calculations or comparisons.

See also  PowerShell If Date Is Older Than 30 Days


Using the Get-Date cmdlet in PowerShell to retrieve the current date without the time is straightforward. Here, I have explained different methods of how to get-date without time in PowerShell.

You may also like: