Re: Date Calculation

2012-11-30 Thread Andrew Kluthe
Thanks everyone for the lovely solutions. It illustrates just how many ways there are to do things in livecode. Peter, No SQLLite here. Just need to set Flexible Learning Company's date picker with dates active for the dates I was trying to calculate. Working great now, thanks. I didn't realize

Re: Date Calculation

2012-11-30 Thread Mike Kerner
ha On Fri, Nov 30, 2012 at 11:24 AM, Andrew Kluthe and...@ctech.me wrote: Thanks everyone for the lovely solutions. It illustrates just how many ways there are to do things in livecode. Peter, No SQLLite here. Just need to set Flexible Learning Company's date picker with dates active for

Re: Date Calculation

2012-11-30 Thread Mike Kerner
sorry, the ha was supposed to be in response to JLG lost at c. funny. You know that C is a write-only language, right? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your

Re: Date Calculation

2012-11-29 Thread Andrew Kluthe
That's what I'm looking for! Great. However, I tried what I think I am supposed to do in the script below and my dates are about three days off. This function is supposed to give me the date for monday of the week where the date paramater is. If the paramater is empty it uses todays date.

Re: Date Calculation

2012-11-29 Thread J. Landman Gay
On 11/29/12 2:23 PM, Andrew Kluthe wrote: That's what I'm looking for! Great. However, I tried what I think I am supposed to do in the script below and my dates are about three days off. This function is supposed to give me the date for monday of the week where the date paramater is. If the

Re: Date Calculation

2012-11-29 Thread Alex Tweedly
On 29/11/2012 20:51, J. Landman Gay wrote: On 11/29/12 2:23 PM, Andrew Kluthe wrote: That's what I'm looking for! Great. However, I tried what I think I am supposed to do in the script below and my dates are about three days off. This function is supposed to give me the date for monday of the

Re: Date Calculation

2012-11-29 Thread Andrew Kluthe
duh. I got focused on getting the concept of the process and wasn't even looking for script errors like that. jeez. Thanks a million, J and Devin. Andrew On Thu, Nov 29, 2012 at 2:51 PM, J. Landman Gay jac...@hyperactivesw.com wrote: On 11/29/12 2:23 PM, Andrew Kluthe wrote: That's what I'm

Re: Date Calculation

2012-11-29 Thread Peter Haworth
Hi Andrew, Do you by any chance have an sqlite database in your application? If so, I can send you a one-line SELECT statement for each date you're looking for that will do all this for you. Pete lcSQL Software http://www.lcsql.com On Thu, Nov 29, 2012 at 12:23 PM, Andrew Kluthe

Re: Date Calculation

2012-11-29 Thread Mike Kerner
Just as an intellectual exercise I worked on shortening the script up because the only way to fix the case is to add a bunch of breaks to it or change the conditionals and order. If you want to shorten it, here's one option: *function* DetermineWeek pDate *if* pDate is empty *then*

Re: Date Calculation

2012-11-29 Thread J. Landman Gay
On 11/29/12 3:23 PM, Mike Kerner wrote: *if* dayNumber=1 *then* *# Sunday, move to previous week* theOffset=6 *else* *# Monday to Saturday* theOffset=dayNumber-2 *end* *if* *# dayNumber=1* Alas, Mike has been lost at C. :) -- Jacqueline Landman Gay |

Re: Date Calculation

2012-11-29 Thread Mark Wieder
Jacque- Thursday, November 29, 2012, 4:10:37 PM, you wrote: Alas, Mike has been lost at C. Hah! -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe

Re: Date Calculation

2012-11-29 Thread Peter Haworth
OK, well I guess no sqlite database in use but just to illustrate, this is how easy this is with a SELECT statement Assuming the date is 11/28/12 per the original email, then to get the next Sunday: SELECT date('2012-11-28', weekday 0) To get the previous Monday: SELECT date('2012-11-28', -7

Re: Date Calculation

2012-11-29 Thread Peter Haworth
Whoops, the weekday 0, weekday 1 and -7 days should all be in single quotes. One of these days, I might try my hand at writing a date calculation function that mimics the SQLite equivalent. They're very powerful and easy to understand. All you need is a base date and a series of modifiers (days

Re: Date Calculation

2012-11-29 Thread J. Landman Gay
On 11/29/12 3:13 PM, Andrew Kluthe wrote: duh. I got focused on getting the concept of the process and wasn't even looking for script errors like that. jeez. Don't feel bad, you aren't alone. I once sent in a bug report to MetaCard with the exact same error. He was nice about it. :) --

Date Calculation

2012-11-28 Thread Andrew Kluthe
Hey Ya'll, I thought I had this figured out but I don't and I am not sure where to go from here. I want to retreive the date for the monday and the sunday of the current week. For instance, if it were today 11/28/2012 then I would want to return 11/26/2012 and 12/2/2012 . I was trying to

Re: Date Calculation

2012-11-28 Thread Devin Asay
On Nov 28, 2012, at 8:33 AM, Andrew Kluthe wrote: Hey Ya'll, I thought I had this figured out but I don't and I am not sure where to go from here. I want to retreive the date for the monday and the sunday of the current week. For instance, if it were today 11/28/2012 then I would want