Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

New-Item change Get-Date format

$
0
0


I have problem with Get-Date and New-Item:

example nr 1:
-------------------
$today = Get-Date
echo $today
-------------------
---> show date format: 7 kwietnia 2014 10:45:11

example nr 2:
-------------------
$today = Get-Date
New-Item -ItemType file -Path C:\test.txt -Force -value $today
echo $today
-------------------

---> show date format:

DisplayHint : DateTime
Date        : 2014-04-07 00:00:00
Day         : 7
DayOfWeek   : Monday
DayOfYear   : 97
Hour        : 10
Kind        : Local
Millisecond : 104
Minute      : 48
Month       : 4
Second      : 36
Ticks       : 635324645161046371
TimeOfDay   : 10:48:36.1046371
Year        : 2014
DateTime    : 7 kwietnia 2014 10:48:36

---> file c:\test.txt contain date format:
2014-04-07 10:48:36

One date variable, three different date formats.

Why New-Item change date format?


Viewing all articles
Browse latest Browse all 6937

Trending Articles