Skip to content

vela-ssoc/vela-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

time

基础时间处理库

example

    local sec = time.sec()
    print(sec) -- 59

    local min = time.min()
    print(min) -- 58

    local hour = time.hour()
    print(hour) -- 01 或 13

    local day = time.day()
    print(day)  -- 30

    local week = time.week()
    print(week) -- Sunday

    local month = time.month()
    print(month) -- 12

    local year = time.year()
    print(year)  -- 2022

    time.sleep(1 * 1000) -- sleep 1s

    local td = time.today() -- 今天
    print(td) -- 2022-02-22

    local td = time.today(1) -- 一天
    print(td) -- 2022-02-23

    local td = time.today(-1) -- 前一天时间
    print(td) -- 2022-02-21