Compare dates question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Compare dates question
Hello guys
how do you go about comparing dates?
am trying to compare dates in the following format "10/10/19" but results are erratic
ex.
put the date into vDate
if "10/10/19" => vDate then bla bla bla
what is the correct way of comparing dates
right now am just trying to check if a specific date has passed
thanks
how do you go about comparing dates?
am trying to compare dates in the following format "10/10/19" but results are erratic
ex.
put the date into vDate
if "10/10/19" => vDate then bla bla bla
what is the correct way of comparing dates
right now am just trying to check if a specific date has passed
thanks
Re: Compare dates question
To compare 2 dates : convert them to "seconds".
Code: Select all
put "12/01/19" into tDate
convert tDate from english date to seconds
put the english date into tDateNow
convert tDateNow from english date to seconds
if tDate>tDateNow then
answer "After"
else
answer "Before"
end if
Re: Compare dates question
Worked like a charm
Thanks Bangkok
Thanks Bangkok
Re: Compare dates question
Just out of curiosity , when you convert the date in seconds it starts counting from which year?
I mean second 0 corresponds to what date?
I mean second 0 corresponds to what date?
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Compare dates question
LiveCode uses the "UNIX Epoch": January 1, 1970
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Compare dates question
A useful tip about "seconds": along with "internet date", those are the only two built-in formats that safely convert across time zones. "Seconds" are GMT, and "internet date" contains a time zone signifier.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Compare dates question
There is a very good LiveCode date library
https://github.com/derbrill/libdate
https://github.com/derbrill/libdate
shiftLock happens
Re: Compare dates question
very useful tips indeed
thanks you very much guys
thanks you very much guys
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Compare dates question
Hi.
Check out this thread, which deals with times before the beginning of time.
viewtopic.php?f=9&t=26619&p=138530&hili ... ng#p138530
Craig
Check out this thread, which deals with times before the beginning of time.
viewtopic.php?f=9&t=26619&p=138530&hili ... ng#p138530
Craig