PowerShell日期/时间转换(PowerShell date/time conversion)

编程入门 行业动态 更新时间:2024-10-26 11:24:38
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/2012

Use 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

更多推荐

本文发布于:2023-08-02 20:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1381469.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日期   时间   PowerShell   conversion   time

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!