Counting days from a past date

Bob Sneidar bobs at twft.com
Tue May 8 17:42:11 EDT 2012


Also, it seems you can use the julianday function in sqLite, which is embedded in Livecode. 

select julianday('2012-05-08') - julianday('2012-03-12') as day

I have not tested this though.

Bob


On May 8, 2012, at 2:18 PM, Bob Sneidar wrote:

> Not only is it not an integer, even if you strip the modulus, 57 is the wrong answer for scenario 2. I suspect it will be wrong for every date prior to that. This is where the julian date comes in handy. We really need julian in the convert parameters. 
> 
> If you have access to a mySQL database, you can use this query:
> 
> select datediff("2012-05-08","2012-03-12") as days
> 
> Bob
> 
> 
> On May 8, 2012, at 1:32 PM, dfepstein at comcast.net wrote:
> 
>> 
>> 
>> 
>> I want to count the number of days between some past date and today. 
>> 
>> I tried this (using Rev 3.0): 
>> 
>> 
>> 
>> on mouseUp 
>> 
>> put "March 12, 2012" into a 
>> 
>> convert a to seconds -- LC should understand this as midnight 
>> 
>> get the date 
>> 
>> convert it to seconds -- should also be midnight 
>> 
>> put (it - a)/(24*3600) -- elapsed seconds divided by seconds per day 
>> 
>> end mouseUp 
>> 
>> 
>> 
>> This yields "57", which seems right. 
>> 
>> 
>> 
>> But if I change the first line to 
>> 
>> 
>> 
>> put "March 11, 2012" into a 
>> 
>> 
>> 
>> the result is not an integer: 
>> 
>> 57.958333 
>> 
>> 
>> 
>> Why would that be? 
>> 
>> 
>> 
>> David Epstein 
>> _______________________________________________
>> 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