Lua common time functions use instances _lua

Source: Internet
Author: User
--Get current GMT print (Os.time ())--Gets the string representation of the current time, in the form of: 11/28/08 10:28:37 print (Os.date ())--Gets the string representation of the current date, in the form: 11/28/08 print (Os.date ("%x", Os.time ())--Gets the string representation of the current time, in the form of: 10:28:37 print (Os.date ("%x", Os.time ())--Gets the string representation of the current time, in the form of: 10/10/13 10:28:37 Print (Os.date ("%c", Os.time ())--Gets the string representation of the current time, in the form of 2013-10-10 10:28:37 print (Os.date%y-%m-%d,  Os.time ())--function Os.clock returns the number of clock seconds that the CPU spends executing the program local x1 = Os.clock () Local s = 0 for i = 1, 10000000 do s = s + I end local x2 = Os.clock () print (String.Format ("Elapsed time:%.2f\n", x2-x1)) Local t2009_starttime = {year=2013, month=2, day=9, H Our=0, min=0, sec=0} local t2009_endtime = {year=2013, month=2, day=17, hour=23, min=59, sec=59} t2009_avtivitytime = {starttime = Os.time (t2009_starttime), Endtime = Os.time (t2009_endtime)} print (' Success of loading package activity, Activity time: ' ... os.date ('%c ', t2009_
Avtivitytime.starttime). '~' ..  Os.date ('%c ', t2009_avtivitytime.endtime)) temp = Os.date ("*t", Os.time ()) print (temp)--[[produces the table {year = 1998, month = 9,Day = Yday = 259, Wday = 4, hour = n, min =, sec = ten, Isdst = false}--]
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.