tags:

views:

8378

answers:

3

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

+2  A: 

$fileDate = $fileDate.ToString("M-d-yyyy")

EBGreen
+3  A: 
$filedate = get-date -format "M-d-yyyy"
Gordon Bell
A: 

is there a way to get-member or get all the options for the ToString() function?

phill
Well, there is really only one option...the format string. If you want to know about what can go in the format string, then there are lots of refences on the web. Here is one: http://msdn.microsoft.com/en-us/library/97x6twsz.aspx
EBGreen