awk 'BEGIN{aa=strftime("%a","1370210542");print aa}'
#Mon
awk 'BEGIN{aa=strftime("%Y-%m-%d %H:%M:%S","1370210542");print aa}'
#2013-06-03 06:02:22
awk 'BEGIN{aa=strftime("%Y-%m-%d %H:%M:%S",1370210542234/1000);print aa}'
#2013-06-03 06:02:22
awk 'BEGIN{aa=strftime("%Y-%m-%d %H:%M:%S",mktime("2013 06 02 08 00 00"));print aa}'
#2013-06-02 08:00:00
返回当前时间戳 systime()
awk 'BEGIN {
print "当前时间的时间戳为:" systime()
}'
时间字符串转时间戳 mktime(datespec)
mktime() 函数用于将指定格式的 时间字符串 转换为 时间戳。
awk 'BEGIN {
print "当前时间的时间戳为:" mktime("2019 05 30 21 27 10")
}'
格式化时间函数 strftime([format [, timestamp[, utc-flag]]])
strftime() 函数用于将一个 时间戳 格式的时间根据指定的 时间格式化符 转成字符串形式表示
awk 'BEGIN {
print strftime("当前时间是:%m/%d/%Y %H:%M:%S", systime())
}'
posted on
浙公网安备 33010602011771号