我无法转换“法国日期”。有什么想法吗?
我找不到任何解决方案...您可以看到我需要转换为注释(#)的日期的示例
# 06.11.2016 02:00
$format = "dd.MM.yyyy HH:mm"
$provider = [System.Globalization.CultureInfo]::CurrentCulture
$newDate = [datetime]::ParseExact($dateCreaString,$format,$provider)
Exception when calling "ParseExact" with "3" argument(s): "The string has not been recognized as a valid DateTime. »
+ $newDate = [datetime]::ParseExact($dateCreaString,$format,$provid ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FormatException
答案 0 :(得分:0)
我不确定我是否完全了解您的要求,但是如果您只是想格式化日期,可以使用此功能...
$date=Get-Date -UFormat "%d.%m.%Y %H:%M"