Date difference

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Date difference

shelane
In Lasso 8.5.5 this is resulting in 60 when it should be 61:

[date_format(date, -format='%Q')->difference(date('8/24/2009'), -day)]

there are 31 days in July. Does date difference not actually count the
number of days?



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Reply | Threaded
Open this post in threaded view
|

Re: Date difference

decorior
I think you may be able to see other posts on this, but  the date  
difference can give some strange answers if you do not include the  
time or take any time changes into account.

Not sure if this is the case here, but it should work if you set the  
time

Deco


On Jun 24, 2009, at 12:55 PM, Shelane Enos wrote:

> In Lasso 8.5.5 this is resulting in 60 when it should be 61:
>
> [date_format(date, -format='%Q')->difference(date('8/24/2009'), -day)]
>
> there are 31 days in July. Does date difference not actually count the
> number of days?
>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Reply | Threaded
Open this post in threaded view
|

Re: Date difference

Bil Corry-3
In reply to this post by shelane
Shelane Enos wrote on 6/24/2009 1:55 PM:
> In Lasso 8.5.5 this is resulting in 60 when it should be 61:
>
> [date_format(date, -format='%Q')->difference(date('8/24/2009'), -day)]
>
> there are 31 days in July. Does date difference not actually count the
> number of days?

LP8 uses the time component when calculating, and since the current date/time isn't midnight, it means one day is truncated.  This works though (setting the time component to midnight):

=========================================================
[date(date,-hour=0,-minute=0,-second=0)->difference(date('8/24/2009'), -day)]

LP8:  61
=========================================================

But that's still subject to DST clock skew, so this is the best method (ensuring the difference is > 24 hours by setting the time component to midnight and noon respectively):

=========================================================
[date(date,-hour=0,-minute=0,-second=0)->difference(date('12/24/2009 12:00:00'), -day)]

LP8:  184
=========================================================


- Bil



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


Reply | Threaded
Open this post in threaded view
|

Re: Date difference

Steve Upton
In reply to this post by shelane
At 11:55 AM -0700 6/24/09, Shelane Enos wrote:
>In Lasso 8.5.5 this is resulting in 60 when it should be 61:
>
>[date_format(date, -format='%Q')->difference(date('8/24/2009'), -day)]
>
>there are 31 days in July. Does date difference not actually count the
>number of days?
>

Think back to the great scene in the movie "Phenomenon" between John Travolta's character and the interviewer played by Brent Spiner.

The interviewer asks for the age of a person born on a certain date. Travolta's response is all about the loose specification of the original question.

Put Lasso in Travolta's position and you'll understand perfectly.

If you haven't seen the movie, it's worth the effort.

regards,

Steve


--


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/