标准时间和格式化时间的转换-awk
上一篇 /
下一篇 2008-10-10 15:15:37
date命令和strftime函数,扩展clock、hwclock
date命令:print or set the system date and time
strftime函数:awk调用了类型为time_t的c函数库 strftime([format [, timestamp]])
功能:Formats timestamp according to the specification in format.
systime函数:同上,Returns the current time of day as the number of seconds since the Epoch systime()
譬如:毫秒级时间戳->格式化时间:echo 12879350 | awk '{print strftime("%F %T", $0)}'
格式化时间->毫秒级时间戳:date -s把当前时间设置成special time,然后 awk '{print systime()}'即可
收藏
举报
TAG: