lua: added time
This commit is contained in:
parent
b8a9aa26e4
commit
7f31fefe6b
15
lua/time/main.lua
Normal file
15
lua/time/main.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
-- Create a table named time to store current time
|
||||||
|
time = os.date("*t")
|
||||||
|
|
||||||
|
-- Old stand by
|
||||||
|
print (time.year .. "-" .. time.month .. "-" .. time.day)
|
||||||
|
|
||||||
|
-- Allow for beter control, seems to print up to 2 decimal places
|
||||||
|
-- Not actually sure how this works
|
||||||
|
-- The first number seems to add perceding spaces
|
||||||
|
-- The second number seems to add perceding 0's
|
||||||
|
print (("%02d-%02d-%02d"):format(time.year, time.month, time.day))
|
||||||
|
|
||||||
|
-- Concat with a deliminator noted at the end
|
||||||
|
print (table.concat({time.year, time.month, time.day}, "-"))
|
Loading…
x
Reference in New Issue
Block a user