lua-users home
lua-l archive

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

On Wed, May 6, 2009 at 6:33 PM, Diego - Red Baires <> wrote:

hi again guys,

i cant find information regarding the comparision of dates and times.

myDate = "05/21/2009";

if (> myDate) then
  print "myDate is a previuos date";

if ( = myDate) then
  print "myDate is today";

if ( < myDate) then
  print "myDate is in the future";

is this correct ?
will this work to all locales ?
what about comparing times ? (i mean, if a time is between two values)

thanks one more time

No that won't work. Dates are tricky to handle. And it's not good to treat them as strings.

Have a look at the luadate library: