Difference between revisions of "User:Kebap/Manual:getTime"
Jump to navigation
Jump to search
(Created page with ";getTime(returntype, format) :returntype takes a boolean value (in Lua anything but false or nil will translate to true). If false, the function will return a table in the fol...") |
m |
||
Line 1: | Line 1: | ||
+ | ==getTime== | ||
;getTime(returntype, format) | ;getTime(returntype, format) | ||
:returntype takes a boolean value (in Lua anything but false or nil will translate to true). If false, the function will return a table in the following format: | :returntype takes a boolean value (in Lua anything but false or nil will translate to true). If false, the function will return a table in the following format: |
Latest revision as of 19:20, 5 June 2018
getTime
- getTime(returntype, format)
- returntype takes a boolean value (in Lua anything but false or nil will translate to true). If false, the function will return a table in the following format:
{ 'min': #, 'year': #, 'month': #, 'day': #, 'sec': #, 'hour': #, 'msec': # }
If true, it will return the date and time as a string using a format passed to the format arg or the default of "yyyy.MM.dd hh:mm:ss.zzz" if none is supplied:
2012.02.18 00:52:52.489
Format expressions:
h the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display) hh the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display) H the hour without a leading zero (0 to 23, even with AM/PM display) HH the hour with a leading zero (00 to 23, even with AM/PM display) m the minute without a leading zero (0 to 59) mm the minute with a leading zero (00 to 59) s the second without a leading zero (0 to 59) ss the second with a leading zero (00 to 59) z the milliseconds without leading zeroes (0 to 999) zzz the milliseconds with leading zeroes (000 to 999) AP or A use AM/PM display. AP will be replaced by either "AM" or "PM". ap or a use am/pm display. ap will be replaced by either "am" or "pm". d the day as number without a leading zero (1 to 31) dd the day as number with a leading zero (01 to 31) ddd the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses QDate::shortDayName(). dddd the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). Uses QDate::longDayName(). M the month as number without a leading zero (1-12) MM the month as number with a leading zero (01-12) MMM the abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses QDate::shortMonthName(). MMMM the long localized month name (e.g. 'January' to 'December'). Uses QDate::longMonthName(). yy the year as two digit number (00-99) yyyy the year as four digit number
All other input characters will be ignored. Any sequence of characters that are enclosed in single quotes will be treated as text and not be used as an expression. Two consecutive single quotes ('') are replaced by a single single quote in the output.
- Example
-- Get time as a table
getTime()
-- Get time with default string
getTime(true)
-- Get time without date and milliseconds
getTime(true, "hh:mm:ss")