Compare dates in Lingo

How do I compare two dates in Lingo? To be specific, I want to know if today's date was after some fixed date. I know I can create a fixed date using:

date("20090101")

      

and I can get the current date using:

_system.date()

      

but I cannot directly compare the two. Do I have to parse _system.date () to determine if it was after my fixed date? I tried:

if(_system.date() > date("20090101") then
    --do something
end if

      

but that doesn't seem to work. Any ideas?

0


source to share


2 answers


Instead of _system.date (), try _movie.systemDate (), it will return a date object that you can safely compare to another.

if _movie.systemDate ()> date ("20090101") then

--do something

      



end if

considers

+2


source


I ended up doing the following. Inelegant, but it works:

  if (_system.date().char[1..2] >= 01 and _system.date().char[4..5] >= 01 and _system.date().char[7..10] >= 2010) then
    alert("Your license has expired. Please contact the Company to renew your license.")
    _player.quit()
  end if

      



It's a trick, but I'll still be interested in alternative ways of doing this.

0


source







All Articles