Date Calculation

Robert Sneidar slylabs13 at me.com
Sat Dec 1 15:30:08 EST 2012


Doesn't sqLite have date math functions? I would create an sqLite database in memory, create a table with a date column, put todays date into it in SQL format (yyyy-mm-dd), then query it using the built in sqLite date math functions. 

eg. SELECT date('now','start of month','+1 month','-1 day');
In your case: 
SELECT date('now', 'start of week');
SELECT date('now', 'end of week');

I might be mistaken tho' haven't tested it...

Bob


On Nov 28, 2012, at 5: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 to return
> 11/26/2012 and 12/2/2012 . I was trying to leverage Sara R's Date &
> Time library, but even with all those lovely functions I still can't
> get what I am after. I know there has to be a simpler way of doing
> this than the broken mess I was coming up with. How would you tackle
> this problem?
> 
> -- 
> Regards,
> 
> Andrew Kluthe
> andrew at ctech.me
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list