PowerShell日期/时间转换(PowerShell date/time conversion)
我有一个变量$ date,包含24 June 2012 00:00:00 。
我怎么把它转换成24/06/2012 ?
I have a variable, $date, containing 24 June 2012 00:00:00.
How do I convert this to 24/06/2012?
最满意答案
将Get-Date cmdlet与Format参数一起使用:
PS> $date = '24 June 2012 00:00:00' PS> Get-Date $date -Format 'dd/MM/yyyy' 24/06/2012Use the Get-Date cmdlet together with the Format parameter:
PS> $date = '24 June 2012 00:00:00' PS> Get-Date $date -Format 'dd/MM/yyyy' 24/06/2012更多推荐
发布评论