Page 1 of 1
Searching between 2 dates?
Posted: Tue Oct 21, 2014 2:25 am
by JackBroughton
Hi LiveCoders
I am pretty new to LiveCode and need some help.
I want to create a list of objects that were created between a certain date.
I have the 2 dates that the user inputs to search between but I cannot find a way to find all objects that were created between those dates.
I hope that makes sense and someone can help?
Thanks in advance.
Re: Searching between 2 dates?
Posted: Tue Oct 21, 2014 3:38 am
by dunbarx
Hi.
There are a lot of date functions. Play around with them all, especially read up on the "convert" command.
But the easiest way to do what you want is to know that there are several "timers" in LC, in the sense that counters have been set up, not since the beginning of time, but reasonably far back to be useful in everyday tasks without having to do any calculations.
So try this in a button:
Now write a simple handler in that same button that will take an arbitrary date and convert that value to "seconds". (remember that "convert" command?) Now think about being able to take any two dates, and convert them both to two distinct "seconds" values.
You are getting warm. Write back if you get stuck.
Craig Newman
Re: Searching between 2 dates?
Posted: Tue Oct 21, 2014 4:10 am
by Simon
Hi,
Let me add one more term "dateItems".
You should use that for all your date related math. (trust me)
Simon
Re: Searching between 2 dates?
Posted: Tue Oct 21, 2014 7:59 am
by jmburnod
Hi,
This thread would be useful:
http://forums.livecode.com/viewtopic.ph ... ilit=+date
Best regards
Jean-Marc
Re: Searching between 2 dates?
Posted: Tue Oct 21, 2014 12:46 pm
by JackBroughton
Thank you all for your help, I got it working with convert but jmburnod your method worked brilliantly and was much more efficient then my solution.
Thank you all again