标准时间和格式化时间的转换-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:

 

评分:0

我来说两句

日历

« 2024-05-08  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 7292
  • 日志数: 21
  • 建立时间: 2008-07-04
  • 更新时间: 2008-10-10

RSS订阅

Open Toolbar