Powershell : how to format get-date to string and remove 0’s


I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying:

$filedate = get-date -uformat "%m-%d-%Y" 
$filedate = $filedate.ToString().Replace("0", "")

this returns "01-04-2008"

I want to the output to be "1-4-2008"

any ideas on another way of doing this?

thanks in advance

Best Solution

$filedate = get-date -format "M-d-yyyy"