[英]change time output in bash script
How to change this time output ? 如何更改此时间输出?
date --date="@$(echo $(TZ=UTC date +%s) - $(date +%s)'%(5*60)-(5*60)' | bc)"
Output: za apr 12 00:25:00 CEST 2014 输出: CEST 2014年4月12日00:25:00
Should output in this layout: %Y%m%d%H%M 应在以下布局中输出: %Y%m%d%H%M
How to implement this in the string ? 如何在字符串中实现呢?
Thanks!! 谢谢!!
i think this should do what you want: 我认为这应该做你想要的:
d="@$(echo $(TZ=UTC date +%s) - $(date +%s)'%(5*60)-(5*60)' | bc)"&&echo `date --date="$d"` `date --date="$d" +%Y%m%d%H%M`
d="@$(echo $(TZ=UTC date +%s) - $(date +%s)'%(5*60)-(5*60)' | bc)"&&echo `date --date="$d" --utc` `date --date="$d" +%Y%m%d%H%M --utc`
Second one is in UTC. 第二个是UTC。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.