常用时间函数

print(os.time()) --当前系统时间值
print(os.date("%Y%m%d",os.time())) --当前系统时间的格式化字符串
print(os.date("*t"), os.time()) --当前系统时间表

table完整版本:

{year=2005, month=11, day=6, hour=22,min=18,sec=30,isdst=false}

分别是:年 月 日 小时 分钟 秒 是否夏令时

字符串转时间值

function string2time( timeString )
local Y = string.sub(timeString , , )
local M = string.sub(timeString , , )
local D = string.sub(timeString , , )
return os.time({year=Y, month=M, day=D, hour=,min=,sec=})
end local sTime = ""
local timeVal = string2time(sTime)
print(sTime)
print(timeVal)

输出结果:

20160202
1454371200

思路:

字符串转换成table,table转换到时间值

Lua常用时间函数的更多相关文章

  1. PLSQL常用时间函数

    body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...

  2. mysql时间类型总结及常用时间函数

    日期时间和类型 常用日期和时间类型 字节 year                1       表示年份                   值范围:(1901----2155) date     ...

  3. mysql常用时间函数与类型转换

    一.用到的函数有: 1.时间格式化函数  DATE_FORMAT(date,format) 2.时间加减函数DATE_ADD(date,INTERVAL expr unit)DATE_SUB(date ...

  4. MySQL常用时间函数

    官方文档:Date and Time Functions Name Description ADDDATE() Add time values (intervals) to a date value ...

  5. Linux时间时区详解与常用时间函数

    时间与时区 整个地球分为二十四时区,每个时区都有自己的本地时间. Ø  UTC时间 与 GMT时间 我们可以认为格林威治时间就是时间协调时间(GMT = UTC),格林威治时间和UTC时间都用秒数来计 ...

  6. Linux常用时间函数

    time()函数: NAME time - get time in seconds SYNOPSIS #include <time.h> time_t time(time_t *tloc) ...

  7. Mysql常用时间函数的用法和应用

    /* ---1)整型时间戳转换为date的格式(yyyymmdd, yyyy年mm月dd)--*/ , '%Y%m%d' ); -- 20090806 , '%Y年%m月%d' ); -- 2009年 ...

  8. MySql 常用时间函数

    1.date() 提取日期或日期时间表达式的日期部分 select date(create_time) from blog_article; 2.date_format() select date_f ...

  9. 常用php时间函数用法汇总

    1.设置时区的方法: php5后都要自己设置时区,要么修改php.ini的设置,要么在代码里修改. 在PHP.INI中设置时区 date.timezone = PRC 在代码中设置时区 1 date_ ...

随机推荐

  1. VMware下的Centos7联网并设置固定IP

    安装CentOS7之后总得联网呀,而且不能一直连服务器,我们需要一个其他工具连它,所以一个固定IP也很重要了. 工具/原料   CentOS7 VMware 方法/步骤     首先设置vmware能 ...

  2. C#获取MySql 数据常用的代码

    1.读取 public DataTable ExecuteDataTable(string SQLString) { using (MySqlConnection connection = new M ...

  3. 【oneday_onepage】——Ten Changes To Make A Difference In Your Life

    When you want to change something in your life, it can feel overwhelming. Whether it’s losing 50lbs ...

  4. eclipse配置google代码风格

    1.下载google code style的xml文件 地址:https://github.com/google/styleguide 导入xml文件 可能会遇到警告: 版本的问题,忽略即可. < ...

  5. PHP判断字符串的包含

    PHP语言是一个功能强大的嵌入式HTML脚本语言,它的易用性让许多程序员选择使用.PHP判断字符串的包含,可以使用PHP的内置函数strstr,strpos,stristr直接进行判断.也可以通过ex ...

  6. Reordering the columns in a data frame

    Problem You want to do reorder the columns in a data frame. Solution # A sample data frame data < ...

  7. $(window).height() 和 $(document).height()的区别

    $(window).height() 和 $(document).height()的区别 $(window).height()代表了当前可见区域的大小,$(document).height()则代表了 ...

  8. android 监听声音变化

    新的项目需要监听android声音的变化,再做出对应的操作,从网上找了个demo验证.记录于此. 参考链接 https://my.oschina.net/yuanxulong/blog/372268 ...

  9. 如何确定拍照时,相机屏幕是横屏or竖屏?

    http://www.eoeandroid.com/thread-80028-1-1.html TAG_DATETIME时间日期 TAG_FLASH闪光灯 TAG_GPS_LATITUDE纬度 TAG ...

  10. Python——with语句、context manager类型和contextlib库

    目录 一.with语句 二.上下文管理器 三.contextlib模块 基本概念 上下文管理协议(Context Management Protocol) 包含方法 __enter__() 和 __e ...