lua的时间和日期函数  

-- ::|  分类: Lua |  标签:lua  时间  函数   |举报|字号 订阅

下载LOFTER客户端
--获取当前的时间戳,单位是秒。
time=os.time();
print(time); --获得当前的时间table,有year,month,day,hour,min,sec等元素。
tab=os.date("*t",time); --或直接tab=os.date("*t"); --tab是table的简写。
print(tab.year, tab.month, tab.day, tab.hour, tab.min, tab.sec); --获得当前的时间字符串,形如"08/27/12"。
str=os.date("%x",time); --或直接使用str=os.date("*x");
print(str); 参考:
os库-时间函数:http://blog.csdn.net/kanelu/article/details/4678903

lua的时间和日期函数的更多相关文章

  1. Python 关于时间和日期函数使用 -- (转)

    python中关于时间和日期函数有time和datatime   1.获取当前时间的两种方法: import datetime,time now = time.strftime("%Y-%m ...

  2. 标准c时间与日期函数

    标准c时间与日期函数 asctime 语法:     #include <time.h>   char *asctime( const struct tm *ptr ); 功能: 函数将p ...

  3. PHP之时间和日期函数

    // 时间日期函数 Time <?php date_default_timezone_set('UTC'); // 获取当前时间的时间戳 $time0 = mktime(); $time1 = ...

  4. mysql 中时间和日期函数应用

    一.MySQL 获得当前日期时间 函数 1.1 获得当前日期+时间(date + time)函数:now() mysql> select now(); +-------------------- ...

  5. python 时间及日期函数

    本人最近新学python ,用到关于时间和日期的函数,经过一番研究,从网上查找资料,经过测试,总结了一下相关的方法. import timeimport datetime '''时间转化为时间戳: 2 ...

  6. [转]详细的mysql时间和日期函数

    这里是一个使用日期函数的例子.下面的查询选择了所有记录,其date_col的值是在最后30天以内: mysql> SELECT something FROM table WHERE TO_DAY ...

  7. mysql 中 时间和日期函数

    From: http://www.cnblogs.com/redfox241/archive/2009/07/23/1529092.html 一.MySQL 获得当前日期时间 函数 1.1 获得当前日 ...

  8. php第五节(字符串函数和时间、日期函数)

    <?php //查找字符串函数 // strpos() 查找字符第一次出现的位置 重点区分大小写 //stripos — 查找字符串首次出现的位置(不区分大小写) //strrpos — 计算指 ...

  9. postgreSQL时间、日期函数

    一.获取系统时间函数 1.1.获取当前完整时间 select now(); select current_timestamp; 1.2.获取当前日期 select currnt_date: 1.3.获 ...

随机推荐

  1. OpenShift helm的安装

    1.安装过程 下载addons的代码 $ git clone https://github.com/jorgemoralespou/minishift-addons $ cd minishift-ad ...

  2. 图灵机器人聊天api

    图灵机器人,功能非常强大,可用于聊天.查询等多个领域 图灵机器人官网:http://www.tuling123.com api地址:http://www.tuling123.com/openapi/a ...

  3. Wishbone总线从接口转Xilinx MIG (Spartan 6)

    //*************************************************************************** // Copyright(c)2016, L ...

  4. Shell学习:if语句 if -z -n -f -eq -ne -lt

    if  条件then Commandelse Commandfi                              别忘了这个结尾 If语句忘了结尾fitest.sh: line 14: sy ...

  5. 2018.1.9 博客迁移至csdn

    http://blog.csdn.net/liyuhui195134?ref=toolbar

  6. Android开发之使用VideoView播放视频

    Android提供了 VideoView组件.它的作用与ImageView类似,仅仅是ImageView用于显示图片.而VideoView用于播放视频. 使用VideoView播放视频的过程例如以下: ...

  7. android工具类(2)NetWorkHelper 网络工具类

    import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkIn ...

  8. 详解php的魔术方法__get()和__set()

    先看看php官方文档的解释:__set() is run when writing data to inaccessible properties.__get() is utilized for re ...

  9. push和unshift方法

    push和unushift都是向数组插入元素. push是向数组尾部插入元素. unshift是向数组头部插入元素. 共同点:都可以一次插入多个元素. arrayObject.push(newelem ...

  10. linux中的strip命令简介------给文件脱衣服

    1.去掉-g,等于程序做了--strip-debug2.strip程序,等于程序做了--strip-debug和--strip-symbol 作为一名Linux开发人员, 如果没有听说过strip命令 ...