I want to share with you an include file with some utility functions/methods to deal with dates and times.
Methods are used with a date object and allow you to manipulate dates comparing, adding, subtracting them with other date objects.
It requires some additional libraries of mine that can be found on my github.
Contents
Code: Select all
FUNCTIONS
DT.DateToDays(dd, mm, yy)
DT.DaysToDate(days, format)
DT.GetMonthDays(monthNum, year)
DT.IsLeap(Year)
DT.MillisecondsToTime(MS, decimal)
DT.MinutesToTime(mins)
DT.MonthToNumber(month)
DT.NDate_AddDays(dd, mm, yy, days)
DT.NumberToMonth(month)
DT.SDate_AddDays(sDate, days)
DT.SecondsToTime(secs)
DT.TimeToMinutes(Tim)
DT.TimeToSeconds(Tim)
DT._anyToSeconds(arg)
OBJECTS/METHODS
TimeObj:Add(tObj)
TimeObj:New(timedef)
TimeObj:NewFileLastChange(filename)
TimeObj:NewNow()
TimeObj:Sub(tObj)
TimeObj:dbgPrint()
TimeObj:equalTo(tObj, threshold)
TimeObj:fromSeconds(seconds)
TimeObj:fromString(s, mode)
TimeObj:fromUnixTimeStamp(timestamp)
TimeObj:greaterThan(tObj, threshold)
TimeObj:lesserThan(tObj, threshold)
TimeObj:toSeconds()
TimeObj:toString(fmt)
TimeObj:toUnixTimeStamp()
TESTS
DT.TEST()
Code: Select all
DT.TEST()
Github : https://github.com/Allanon71/Hollywood-MAL-Libraries
Happy coding!