zoukankan      html  css  js  c++  java
  • lua 中操作系统库

    time 和 date 两个函数在lua中实现所有的时钟查询功能。

    函数time在没有参数时返回当前时钟的数值。(在许多操作系统中,该数值是距离某个特定时间的秒数)。

    date是time的一种“反函数”,将数值转换为年月日时分秒

    使用格式字符"*t",创建一个时间表。

    temp = os.date("*t", 906000490)

    返回的结果为:

    {year=1998, month=9, day=16, yday=259,  wday=4, hour=23, min=48, sec=10, isdst=false}

    还可以按照一定的格式输出,主要使用的格式如下:

    %a          abbreviated weekday name(eg. Wed)   缩写的星期几

    %A          full weekday name(eg. Wednesday)  全写的星期几

    %b          abrreivated month name(eg, Sep)  缩写的月份名

    %B          full month name(eg, September) 全写的月份名

    %c           date and time(eg, 09/16/98 23:48:10)

    %d          day of the month(16)[0-31]

    %H          hour, using a 24-hour clock (23)[0-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(eg, 09/16/98)

    %X           time(eg, 23:48:10)

    %Y           full year(1998)

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

    %%          the character '%'

  • 相关阅读:
    Leetcode 238. Product of Array Except Self
    Leetcode 103. Binary Tree Zigzag Level Order Traversal
    Leetcode 290. Word Pattern
    Leetcode 205. Isomorphic Strings
    Leetcode 107. Binary Tree Level Order Traversal II
    Leetcode 102. Binary Tree Level Order Traversal
    三目运算符
    简单判断案例— 分支结构的应用
    用switch判断月份的练习
    java基本打印练习《我行我素购物系统》
  • 原文地址:https://www.cnblogs.com/rohens-hbg/p/5345018.html
Copyright © 2011-2022 走看看