Lua date format

网上有比较复杂的方法:Date Formatting Functions

 

写了一个非常简单的代码

   1: function formatDate(seconds, dateformat)
   2:     --http://wiki.interfaceware.com/569.html
   3:     seconds = tonumber(seconds)
   4:     dateformat = dateformat or "%Y-%m-%d %H:%M:%S"
   5:     
   6:     return os.date(dateformat, seconds)
   7: end

格式化的参数可查看这里:http://wiki.interfaceware.com/569.html

posted @ 2013-08-27 21:13  meteoric_cry  阅读(1566)  评论(0编辑  收藏  举报