View Single Post
Old 05-11-2007   #2 (permalink)
Don Jones [MVP]


 
 

Re: Add Date and time to filename

if...
$d = get-date

then...
$d.year() + $d.month() + $d.day() + "-" $d.hour + $d.minute

Or something along those lines - use the methods of the datetime object to
get just the bits you want. You can also run $d.GetDateTimeFormats() to see
if one of the predefined string formats will work for you.

--
Don Jones
Windows PowerShell MVP
Founder: www.ScriptingAnswers.com
Co-Author: "Windows PowerShell: TFM"

"Jimbo" <Jimbo@discussions.microsoft.com> wrote in message
news:333EB1A8-E981-4882-BA24-35D13000DA4E@microsoft.com...
> How do I add the date and time onto a filename I am generating in format
> somefilename20070511-0911 ?
>
> Thanks


My System SpecsSystem Spec