微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

lua 获得系统时间

系统到现在多少秒

local ntime = os.time

print(ntime)

代码如下:

function CallChannel()
 local dateText = os.date("%c");
 if dateText~="" then
  channel.GetChild(0):SetText(dateText);
 end
end

其中的%c可以是以下的一种:

%a

abbreviated weekday name (e.g.,Wed)

%A

full weekday name (e.g.,Wednesday)

%b

abbreviated month name (e.g.,Sep)

%B

full month name (e.g.,September)

%c

date and time (e.g.,09/16/98 23:48:10)

%d

day of the month (16) [01-31]

%H

hour,using a 24-hour clock (23) [00-23]

%I

hour,using a 12-hour clock (11) [01-12]

%M

minute (48) [00-59]

%m

month (09) [01-12]

%p

either "am" or "pm" (pm)

%S

second (10) [00-61]

%w

weekday (3) [0-6 = Sunday-Saturday]

%x

date (e.g.,09/16/98)

%X

time (e.g.,23:48:10)

%Y

full year (1998)

%y

two-digit year (98) [00-99]

%%

the character '%'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐