简体   繁体   中英

How echo a datetime in “YYYY-MM-DD” format in linux and powershell with a same command?

I do have a php 'composer' command which generates a .zip package for deploy.

this package should have the datetime as sufix, for instance release-2018-09-12 or release-2018091 .

However some of our programmers and freelancers use both windows and Linux.

The date +%Y-%m-%d only works on Linux. but not on windows.

How can I write a command that works both in Linux or windows (powershell)? or a workaround to it?

Get-Date的“ -UFormat”开关代表“ Unix格式”

Get-Date -Uformat "%Y-%m-%d"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM