Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Why cant I format a System DateTime correctly using custom formatting?

$
0
0

Hello,

When I execute a "ls c:\windows\LogFiles | gm", I see a Typename: System.IO.FileInfo with a Property of CreationTime which is a System.DateTime.  Im trying to format this System.DateTime by issuing a $DT = $_.CreationTime -f "MM_dd_yy HH_mm_ss", but what always comes back is a format of 06/17/2013 07:36:51.  Why is this?  How can I custom format this property to the form I need?


Thanks for your help! SdeDot


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>