File DateTime.lua
Functions
DateTime:formatDate (time) | Format date in default format. |
DateTime:formatDateTime (time) | Format date/time in default format. |
DateTime:formatTime (time) | Format time in default format. |
DateTime:formatTimeDiff (secs) | Convert a number of seconds to hours:mm:ss format. |
DateTime:formatTimeDiffMsec (secs) | Format time difference as number.msec |
DateTime:new (t) | Constructor for new instance. |
DateTime:newClass (t) | Constructor for extending class. |
DateTime:parseHhMmAmPmTime (timeStr) | Parse time in HH:MM{AM/PM} format. |
DateTime:parseMmDdYyDate (dateStr) | Parse date in MM-DD-YY format. |
DateTime:parseYyyyMmDdDate (a, sep) | Parse date from string, when expressed year first, 4 digits followed by separator (default separator is dash, slash (forward or back), or underscore) and 1-2 char mo. |
DateTime:timeStruct (dt, ofs, includeJulianDay) | Format time as structure with named members (numerical values). |
DateTime:timeToUtcFormat (time, offset, dls) | Format time in UTC standard notation, with ms. |
Functions
- DateTime:formatDate (time)
-
Format date in default format.
Parameters:
-
time
:
-
- DateTime:formatDateTime (time)
-
Format date/time in default format.
Parameters:
-
time
:
-
- DateTime:formatTime (time)
-
Format time in default format.
Parameters:
-
time
:
-
- DateTime:formatTimeDiff (secs)
-
Convert a number of seconds to hours:mm:ss format.
Parameters:
-
secs
: time difference in seconds.
Usage:
Takes a number, not a string.
Uses lr-path-utils-remove-extension (floor) instead of lr-string-utils-number-to-string (may round up).
Reminder: Very small time differences wreak havoc - round to zero for sanity.
-
- DateTime:formatTimeDiffMsec (secs)
-
Format time difference as number.msec
Parameters:
-
secs
:
-
- DateTime:new (t)
-
Constructor for new instance.
Parameters:
-
t
:
-
- DateTime:newClass (t)
-
Constructor for extending class.
Parameters:
-
t
:
-
- DateTime:parseHhMmAmPmTime (timeStr)
-
Parse time in HH:MM{AM/PM} format.
Motivation for creation: Originally created to support windows directory entry parsing.
the unix version is in the ftp module for now (thats the only place its used).
Parameters:-
timeStr
:
Usage:
Error handling is a bit weak. ###4
Will not work after 1-1-2070.
Return value:
- hour (0-23), minute (0-59), else error message.
-
- DateTime:parseMmDdYyDate (dateStr)
-
Parse date in MM-DD-YY format.
Motivation for creation: Originally created to support windows directory entry parsing.
the unix version is in the ftp module for now (thats the only place its used).
Parameters:-
dateStr
:
Usage:
Error handling is a bit weak. ###4
Will not work anymore after 1-1-2070.
Return value:
- 4-digit year, month(1-12), day(1-31) numbers, else error message.
-
- DateTime:parseYyyyMmDdDate (a, sep)
-
Parse date from string, when expressed year first, 4 digits followed by separator (default separator is dash, slash (forward or back), or underscore) and 1-2 char mo. then 1-2 char day.
Parameters:
-
a
: -
sep
:
Usage:
Examples:
2013-12-31 (valid)
2014/1/1 (valid)
2014_01_01 (valid)
14/01/01 (NOT valid) -
- DateTime:timeStruct (dt, ofs, includeJulianDay)
-
Format time as structure with named members (numerical values).
Parameters:
-
dt
: -
ofs
: -
includeJulianDay
:
-
- DateTime:timeToUtcFormat (time, offset, dls)
-
Format time in UTC standard notation, with ms.
Parameters:
-
time
: from arbitrary time zone. -
offset
: seconds from utc. -
dls
: flag for dls adjustment.
-