Difference between revisions of "Os.time"
From GiderosMobile
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | + | '''Available since:''' Gideros 2011.6<br/> | |
− | ''' | + | '''Class:''' [[os]]<br/> |
− | ''' | ||
− | |||
− | |||
+ | === Description === | ||
+ | Returns the current time when called without arguments, or a time representing the date and time specified by the given table. | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | (number) = os.time(table) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ''table'' fields: | ||
+ | *'''year''' | ||
+ | *'''month''' | ||
+ | *'''day''' | ||
+ | *'''''hour''''' ''optional'' | ||
+ | *'''''min''''' ''optional'' | ||
+ | *'''''sec''''' ''optional'' | ||
+ | *'''''isdst''''' ''optional'' | ||
+ | |||
+ | '''The returned value is a number, whose meaning depends on your system. In POSIX, Windows, and some other systems, this number counts the number of seconds since some given start time (the "epoch": 1 January 1970, 00:00:00). In other systems, the meaning is not specified, and the number returned by time can be used only as an argument to date and ''difftime''''' | ||
− | + | === Parameters === | |
− | + | '''table''': (table) table representing a date time '''optional'''<br/> | |
− | + | ||
− | + | === Return values === | |
− | === | + | '''Returns''' (number) time in seconds<br/> |
− | '''table''': (table) | + | |
− | === | + | === Example === |
− | ''' | + | <syntaxhighlight lang="lua"> |
+ | local myt = os.time({year=2003, month=7, day=14, hour=8}) | ||
+ | print(myt) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === See also === | ||
+ | [[Os.date]] | ||
{{Os}} | {{Os}} |
Latest revision as of 22:46, 14 October 2023
Available since: Gideros 2011.6
Class: os
Description
Returns the current time when called without arguments, or a time representing the date and time specified by the given table.
(number) = os.time(table)
table fields:
- year
- month
- day
- hour optional
- min optional
- sec optional
- isdst optional
The returned value is a number, whose meaning depends on your system. In POSIX, Windows, and some other systems, this number counts the number of seconds since some given start time (the "epoch": 1 January 1970, 00:00:00). In other systems, the meaning is not specified, and the number returned by time can be used only as an argument to date and difftime
Parameters
table: (table) table representing a date time optional
Return values
Returns (number) time in seconds
Example
local myt = os.time({year=2003, month=7, day=14, hour=8})
print(myt)
See also