Skip to content

Commit

Permalink
Create 获取当前日期及时间.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
chudongjingling authored May 22, 2020
1 parent 33e6f5f commit a1674c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 日期与时间/获取当前日期及时间.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local nowTime = os.date("*t",os.time()) --返回一个 table
dialog(nowTime.year, 0) --
dialog(nowTime.month, 0) --
dialog(nowTime.day, 0) --
dialog(nowTime.hour, 0) --小时
dialog(nowTime.min, 0) --分钟
dialog(nowTime.sec, 0) --秒钟
dialog(nowTime.yday, 0) --显示当前为一年中的第几天

--时间戳格式化当前时间
local nowTime = os.date("%Y-%m-%d %H:%M:%S", os.time())
dialog(nowTime,0)

0 comments on commit a1674c4

Please sign in to comment.