lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi guys, after reading your comments i finally choose this solution
(i first selected comparing strings, but "2009/13/25" is a "valid" input, so i dropped it)


i need to represent a range or dates, and then a range of time.
i have a list of records that indicates that an event must be
executed only if:
a) today is between the fields that indicates a range of dates, and then
b) os system.clock is between the fields that indicates a range of hours.

(is today between date-A and date-B, if so, is now between 3pm and 4pm?)

so i am doing this:

between_date_from = os.time({ year="2008", month="01", day="01", hour="00", min="00" })
between_date_to   = os.time({ year="2009", month="05", day="06", hour="00", min="00" })

today = os.time()

if (today> between_date_from) and (today < (between_date_to+86400)) then
  print "today IS between the range of dates"
  print "today is NOT between the range of dates"

now the problem is how to analize a range of hours, not taking in mind the date.
any idea ?

"os.time()" does not allow (obviously) an assignation like this:
{ year="0000", month="00", day="00", hour="17", min="30" }


Windows Live™: Keep your life in sync. Check it out!