我有 velow 脚本
$AddDays = Read-Host "How long user will be active (: in Days) "
$DateInFuture = (Get-date).AddDays($AddDays).ToString('yyyy-mm-dd')
Run Code Online (Sandbox Code Playgroud)
我想在当前日期中添加天数,但我得到了这样的东西..
“2020-57-18”
假设今天是“2020-04-18”,我添加了 5 天...如何使用这种格式添加天数?年-月-日
You need to change the format using inside the ToString, mm represents minutes and MM represents months
$AddDays = Read-Host "How long user will be active (: in Days) "
$DateInFuture = (Get-date).AddDays($AddDays).ToString('yyyy-MM-dd')
Run Code Online (Sandbox Code Playgroud)
This get's the desired output of 2020-04-18
| 归档时间: |
|
| 查看次数: |
15259 次 |
| 最近记录: |