Age tag

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

Age tag

list
Does anyone know of an age tag?

Simple task of inputting two dates and getting the age as result.
Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!! :-)
This might be the year I will turn 51 but we're not there yet.

Tried Tagswap without success.
Can't be the first needing this kind of calculation.

HDB
Jolle

--
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: Age tag

Viaduct Productions

On 2010-02-28, at 11:26 PM, Jolle Carlestam wrote:

> Does anyone know of an age tag?

I think it's called a birthday.  I use it once a year…this Wednesday in fact.  

_____________
Rich in Toronto


--
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: Age tag

decorior
In reply to this post by list
I am sure I use date->difference with the -year option

I think you just have to be careful on the actual day

On Feb 28, 2010, at 9:26 PM, Jolle Carlestam wrote:

> Does anyone know of an age tag?
>
> Simple task of inputting two dates and getting the age as result.
> Duration doesn't cut it. When I try, it claims that I'm 51 years  
> old. I'M NOT!! :-)
> This might be the year I will turn 51 but we're not there yet.
>
> Tried Tagswap without success.
> Can't be the first needing this kind of calculation.
>
> HDB
> Jolle
>
> --
> 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: Age tag

list
In reply to this post by Viaduct Productions

1 mar 2010 kl. 14.27 skrev Viaduct Productions:

>
> On 2010-02-28, at 11:26 PM, Jolle Carlestam wrote:
>
>> Does anyone know of an age tag?
>
> I think it's called a birthday.  I use it once a year…this Wednesday in fact.

Well, congratulations!

Then I hope the nurses will allow you at least one beer on Wednesday. :-)

I was hoping for something more in the style of

var('rich_birthday' = age(-dob = '1918-03-03', date) -> year);


HDB
Jolle

--
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: Age tag

Viaduct Productions

On 2010-02-28, at 11:33 PM, Jolle Carlestam wrote:

> Well, congratulations!
>
> Then I hope the nurses will allow you at least one beer on Wednesday. :-)

They will have to undo the straight jacket first.  

> I was hoping for something more in the style of
>
> var('rich_birthday' = age(-dob = '1918-03-03', date) -> year);

Cmon, if I was that old I'd be using Filemaker.  

_____________
Rich in Toronto


--
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: Age tag

list
In reply to this post by decorior
No, same result:

var('dob' = date('1959-08-13'));
var('now' = date);

$dob -> Difference($now, -Year);
'<br>';
duration($now - $dob) -> year;

Result:
51
51

It should be 50 since I won't be 51 until August this year.

HDB
Jolle


1 mar 2010 kl. 14.30 skrev Deco Rior (Tennissource):

> I am sure I use date->difference with the -year option
>
> I think you just have to be careful on the actual day
>
> On Feb 28, 2010, at 9:26 PM, Jolle Carlestam wrote:
>
>> Does anyone know of an age tag?
>>
>> Simple task of inputting two dates and getting the age as result.
>> Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!! :-)
>> This might be the year I will turn 51 but we're not there yet.
>>
>> Tried Tagswap without success.
>> Can't be the first needing this kind of calculation.
>>
>> HDB
>> Jolle
>>
>> --
>> 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/
>
>
>
>
>



--
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: Age tag

stevepiercy
In reply to this post by list
[date_difference(date,date($date_of_birth))->year]

--steve


On 3/1/10 at 2:26 PM, [hidden email] (Jolle Carlestam) pronounced:

>Does anyone know of an age tag?
>
>Simple task of inputting two dates and getting the age as result.
>Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!! :-)
>This might be the year I will turn 51 but we're not there yet.
>
>Tried Tagswap without success.
>Can't be the first needing this kind of calculation.
>
>HDB
>Jolle
>
>--
>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/
>
>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
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: Age tag

list
In reply to this post by Viaduct Productions
1 mar 2010 kl. 14.36 skrev Viaduct Productions:

>> var('rich_birthday' = age(-dob = '1918-03-03', date) -> year);
>
> Cmon, if I was that old I'd be using Filemaker.  


Sorry, must have been a typo.
var('rich_birthday' = age(-dob = '1935-03-03', date) -> year);

HDB
Jolle


--
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: Age tag

Brian Loomis-3
In reply to this post by stevepiercy
according to that I'm 40, but my birthday isn't until June.

<?LassoScript
        date_difference(date,date('1970-06-28'))->year;
?>

On Feb 28, 2010, at 9:37 PM, Steve Piercy - Web Site Builder wrote:

> [date_difference(date,date($date_of_birth))->year]
>
> --steve
>
>
> On 3/1/10 at 2:26 PM, [hidden email] (Jolle Carlestam) pronounced:
>
>> Does anyone know of an age tag?
>>
>> Simple task of inputting two dates and getting the age as result.
>> Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!! :-)
>> This might be the year I will turn 51 but we're not there yet.
>>
>> Tried Tagswap without success.
>> Can't be the first needing this kind of calculation.
>>
>> HDB
>> Jolle
>>
>> --
>> 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/
>>
>>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy               Web Site Builder               Soquel, CA
> <[hidden email]>                  <http://www.StevePiercy.com/>
>
>
> --
> 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/
>
>

Brian Loomis
http://www.virtualrelations.us
(208) 639-2569 - 208 NEW BLOX
-- email checked daily --


--
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: Age tag

Brian Loomis-3

<?LassoScript
        date_difference(date,date('1970-06-28'))->day / 365.25;
?>


On Feb 28, 2010, at 9:39 PM, Brian Loomis wrote:

> according to that I'm 40, but my birthday isn't until June.
>
> <?LassoScript
> date_difference(date,date('1970-06-28'))->year;
> ?>
>
> On Feb 28, 2010, at 9:37 PM, Steve Piercy - Web Site Builder wrote:
>
>> [date_difference(date,date($date_of_birth))->year]
>>
>> --steve
>>
>>
>> On 3/1/10 at 2:26 PM, [hidden email] (Jolle Carlestam) pronounced:
>>
>>> Does anyone know of an age tag?
>>>
>>> Simple task of inputting two dates and getting the age as result.
>>> Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!! :-)
>>> This might be the year I will turn 51 but we're not there yet.
>>>
>>> Tried Tagswap without success.
>>> Can't be the first needing this kind of calculation.
>>>
>>> HDB
>>> Jolle
>>>
>>> --
>>> 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/
>>>
>>>
>>
>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> Steve Piercy               Web Site Builder               Soquel, CA
>> <[hidden email]>                  <http://www.StevePiercy.com/>
>>
>>
>> --
>> 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/
>>
>>
>
> Brian Loomis
> http://www.virtualrelations.us
> (208) 639-2569 - 208 NEW BLOX
> -- email checked daily --
>
>
> --
> 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/
>
>

Brian Loomis
http://www.virtualrelations.us
(208) 639-2569 - 208 NEW BLOX
-- email checked daily --


--
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: Age tag

list
In reply to this post by stevepiercy
1 mar 2010 kl. 14.37 skrev Steve Piercy - Web Site Builder:

> [date_difference(date,date($date_of_birth))->year]

51. No go.

This is assuming that you're not 1 year old until you've actually lived for 1 year. And not 18 until your 18th birthday.

Trying Steves and Decos suggesions claims that this baby is one year old:

var('dob' = date('2009-08-13 06:00:00'));
var('now' = date);

$dob -> Difference($now, -Year);
'<br>';
date_difference(date,$dob)->year;

In my book it's wrong.

HDB
Jolle

--
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: Age tag

list
In reply to this post by Brian Loomis-3
Congratulation a bit in advance.
But the math is till not to my liking:

date_difference(date,date('2009-08-13'))->day / 365.25;'<br>';
date_difference(date,date('1970-06-28'))->day / 365.25;

0.550308
39.6769

Am I 0.55 years old now? :-)

HDB
Jolle

1 mar 2010 kl. 14.41 skrev Brian Loomis:

> <?LassoScript
> date_difference(date,date('1970-06-28'))->day / 365.25;
> ?>
>
>
> On Feb 28, 2010, at 9:39 PM, Brian Loomis wrote:
>
>> according to that I'm 40, but my birthday isn't until June.
>>
>> <?LassoScript
>> date_difference(date,date('1970-06-28'))->year;
>> ?>
>>
>



--
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: Age tag

Viaduct Productions
In reply to this post by Brian Loomis-3
Mine is wrong as well.  


On 2010-02-28, at 11:39 PM, Brian Loomis wrote:

> according to that I'm 40, but my birthday isn't until June.
>
> <?LassoScript
> date_difference(date,date('1970-06-28'))->year;
> ?>



_____________
Rich in Toronto


--
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: Age tag

stevepiercy
In reply to this post by list
I suspect difference rounds in that context.

     var('dob') = date('1959-08-13');
     var('now') = date;

     loop(50);
         $dob -> Difference($now, -Year);'<br>';
         $dob = date_add($dob,-day=1);
     /loop;

In addition duration uses averages for years and months (365.25
days and 30.4375 days, respectively), so I would not use it for
calculating age.

--steve


On 3/1/10 at 2:37 PM, [hidden email] (Jolle Carlestam) pronounced:

>No, same result:
>
>var('dob' = date('1959-08-13'));
>var('now' = date);
>
>$dob -> Difference($now, -Year);
>'<br>';
>duration($now - $dob) -> year;
>
>Result:
>51
>51
>
>It should be 50 since I won't be 51 until August this year.
>
>HDB
>Jolle
>
>
>1 mar 2010 kl. 14.30 skrev Deco Rior (Tennissource):
>
>>I am sure I use date->difference with the -year option
>>
>>I think you just have to be careful on the actual day
>>
>>On Feb 28, 2010, at 9:26 PM, Jolle Carlestam wrote:
>>
>>> Does anyone know of an age tag?
>>>   Simple task of inputting two dates and getting the age as result.
>>> Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!!
>:-)
>>> This might be the year I will turn 51 but we're not there yet.
>>>   Tried Tagswap without success.
>>> Can't be the first needing this kind of calculation.
>>>   HDB
>>> Jolle
>>>   --
>>> 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/
>>
>>
>>
>>
>>
>
>
>
>--
>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/
>
>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
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: Age tag

stevepiercy
In reply to this post by Brian Loomis-3
Okay, both approaches are incorrect.

Instead examine each bit of date (year, month and day), compare
and do some simple math instead of bogus date-oriented math.  
I'll write it up in a bit.

--steve


On 2/28/10 at 9:39 PM, [hidden email] (Brian Loomis) pronounced:

>according to that I'm 40, but my birthday isn't until June.
>
><?LassoScript
>date_difference(date,date('1970-06-28'))->year;
>?>
>
>On Feb 28, 2010, at 9:37 PM, Steve Piercy - Web Site Builder wrote:
>
>>[date_difference(date,date($date_of_birth))->year]
>>
>>--steve
>>
>>
>>On 3/1/10 at 2:26 PM, [hidden email] (Jolle Carlestam) pronounced:
>>
>>> Does anyone know of an age tag?
>>>   Simple task of inputting two dates and getting the age as result.
>>> Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!!
>:-)
>>> This might be the year I will turn 51 but we're not there yet.
>>>   Tried Tagswap without success.
>>> Can't be the first needing this kind of calculation.
>>>   HDB
>>> Jolle
>>>   --
>>> 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/
>>>  
>>
>>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>Steve Piercy               Web Site Builder               Soquel, CA
>><[hidden email]>                  <http://www.StevePiercy.com/>
>>
>>
>>--
>>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/
>>
>>
>
>Brian Loomis
>http://www.virtualrelations.us
>(208) 639-2569 - 208 NEW BLOX
>-- email checked daily --
>
>
>--
>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/
>
>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
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: Age tag

list
To late. :-)
Here's the tag:

define_tag(
        'age',
        -description = 'Returns the age as years calculated between to dates.',
        -req = 'dob', -type = 'date',
        -opt = 'dod', -type = 'date'
);

        local('now' = local_defined('dod') ? date(#dod) | date);
       
        return(integer(#dob -> difference(#now, -year)) - ((integer(#dob -> month) * 100) + integer(#dob -> day) > (integer(#dod -> month) * 100) + integer(#dod -> day) ? 1 | 0));

/define_tag;

age(date('1959-08-13'), date);
'<br>';
age(date('1970-06-28'), date);


Result
50
39

And I did not invent the calc bit myself. Google helped me:
http://www.kodyaz.com/articles/calculate-age-sql-code.aspx

HDB
Jolle

1 mar 2010 kl. 15.02 skrev Steve Piercy - Web Site Builder:

> Okay, both approaches are incorrect.
>
> Instead examine each bit of date (year, month and day), compare and do some simple math instead of bogus date-oriented math.  I'll write it up in a bit.
>
> --steve
>
>
> On 2/28/10 at 9:39 PM, [hidden email] (Brian Loomis) pronounced:
>
>> according to that I'm 40, but my birthday isn't until June.
>>
>> <?LassoScript
>> date_difference(date,date('1970-06-28'))->year;
>> ?>
>>
>> On Feb 28, 2010, at 9:37 PM, Steve Piercy - Web Site Builder wrote:
>>
>>> [date_difference(date,date($date_of_birth))->year]
>>>
>>> --steve
>>>
>>>
>>> On 3/1/10 at 2:26 PM, [hidden email] (Jolle Carlestam) pronounced:
>>>
>>>> Does anyone know of an age tag?
>>>>  Simple task of inputting two dates and getting the age as result.
>>>> Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!!
>> :-)
>>>> This might be the year I will turn 51 but we're not there yet.
>>>>  Tried Tagswap without success.
>>>> Can't be the first needing this kind of calculation.
>>>>  HDB
>>>> Jolle
>>>>  --
>>>> 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/
>>>>
>>>
>>> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>> Steve Piercy               Web Site Builder               Soquel, CA
>>> <[hidden email]>                  <http://www.StevePiercy.com/>
>>>
>>>
>>> --
>>> 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/
>>>
>>>
>>
>> Brian Loomis
>> http://www.virtualrelations.us
>> (208) 639-2569 - 208 NEW BLOX
>> -- email checked daily --
>>
>>
>> --
>> 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/
>>
>>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy               Web Site Builder               Soquel, CA
> <[hidden email]>                  <http://www.StevePiercy.com/>
>
>
> --
> 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: Age tag

Frank Filippone-2
In reply to this post by list
Try the following:

Variable('DOB') = Date('1970-8-15');
Variable('Age') = Date->Year - $DOB->Year - (Date->DayOfYear >=
$DOB->DayOfYear ? 0 | 1);


Regards,
Frank Filippone

> -----Original Message-----
> From: Lasso Talk [mailto:[hidden email]] On Behalf Of Jolle
> Carlestam
> Sent: Monday, 1 March 2010 3:26 PM
> To: Lasso Talk
> Subject: Age tag
>
> Does anyone know of an age tag?
>
> Simple task of inputting two dates and getting the age as result.
> Duration doesn't cut it. When I try, it claims that I'm 51 years old.
> I'M NOT!! :-)
> This might be the year I will turn 51 but we're not there yet.
>
> Tried Tagswap without success.
> Can't be the first needing this kind of calculation.
>
> HDB
> Jolle
>
> --
> 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: Age tag

list
Yea, that's working too!

HDB
Jolle

1 mar 2010 kl. 15.11 skrev Frank Filippone:

> Try the following:
>
> Variable('DOB') = Date('1970-8-15');
> Variable('Age') = Date->Year - $DOB->Year - (Date->DayOfYear >=
> $DOB->DayOfYear ? 0 | 1);
>
>
> Regards,
> Frank Filippone
>
>> -----Original Message-----
>> From: Lasso Talk [mailto:[hidden email]] On Behalf Of Jolle
>> Carlestam
>> Sent: Monday, 1 March 2010 3:26 PM
>> To: Lasso Talk
>> Subject: Age tag
>>
>> Does anyone know of an age tag?
>>
>> Simple task of inputting two dates and getting the age as result.
>> Duration doesn't cut it. When I try, it claims that I'm 51 years old.
>> I'M NOT!! :-)
>> This might be the year I will turn 51 but we're not there yet.
>>
>> Tried Tagswap without success.
>> Can't be the first needing this kind of calculation.
>>
>> HDB
>> Jolle
>>
>> --
>> 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/
>
>
>
>
>



--
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: Age tag

list
Redefining the tag using Franks code instead:

define_tag(
        'age',
        -description = 'Returns the age as years calculated between two dates.',
        -req = 'dob', -type = 'date',
        -opt = 'dod', -type = 'date'
);

        local('now' = local_defined('dod') ? date(#dod) | date);
       
        return(integer(#dob -> difference(#now, -year)) - (#now -> dayofyear >= #dob -> dayofyear ? 0 | 1));

/define_tag;

HDB
Jolle

1 mar 2010 kl. 15.16 skrev Jolle Carlestam:

> Yea, that's working too!
>
> HDB
> Jolle
>
> 1 mar 2010 kl. 15.11 skrev Frank Filippone:
>
>> Try the following:
>>
>> Variable('DOB') = Date('1970-8-15');
>> Variable('Age') = Date->Year - $DOB->Year - (Date->DayOfYear >=
>> $DOB->DayOfYear ? 0 | 1);
>>
>>
>> Regards,
>> Frank Filippone
>>
>>> -----Original Message-----
>>> From: Lasso Talk [mailto:[hidden email]] On Behalf Of Jolle
>>> Carlestam
>>> Sent: Monday, 1 March 2010 3:26 PM
>>> To: Lasso Talk
>>> Subject: Age tag
>>>
>>> Does anyone know of an age tag?
>>>
>>> Simple task of inputting two dates and getting the age as result.
>>> Duration doesn't cut it. When I try, it claims that I'm 51 years old.
>>> I'M NOT!! :-)
>>> This might be the year I will turn 51 but we're not there yet.
>>>
>>> Tried Tagswap without success.
>>> Can't be the first needing this kind of calculation.
>>>
>>> HDB
>>> Jolle
>>>
>>> --
>>> 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/
>>
>>
>>
>>
>>
>
>
>
> --
> 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: Age tag

stevepiercy
In reply to this post by stevepiercy
define_tag('age', -description='Returns age in years.  By
default the current date is used to determine age, but can be
overridden by passing in a second date.',
     -namespace='date_',
     -required='dob', -type='date',
     -optional='now', -type='date',
     -priority='replace');
     !local_defined('now') ? local('now') = date;
     local('age') = #now->year - #dob->year;
     if(#now->month - #dob->month <= 0);
         if(#now->day - #dob->day < 0);
             #age-=1;
         /if;
     /if;
     return(#age);
/define_tag;

date_age(-dob=date('2000-02-28'),-now=date('2010-02-27'));'<br>';
date_age(-dob=date('2000-02-28'),-now=date('2010-02-28'));'<br>';
date_age(-dob=date('2000-02-28'),-now=date('2010-03-01'));

9
10
10

--steve


On 2/28/10 at 9:02 PM, [hidden email] (Steve Piercy - Web
Site Builder) pronounced:

>Okay, both approaches are incorrect.
>
>Instead examine each bit of date (year, month and day), compare
>and do some simple math instead of bogus date-oriented math.  
>I'll write it up in a bit.
>
>--steve
>
>
>On 2/28/10 at 9:39 PM, [hidden email] (Brian Loomis) pronounced:
>
>>according to that I'm 40, but my birthday isn't until June.
>>
>><?LassoScript
>>date_difference(date,date('1970-06-28'))->year;
>>?>
>>
>>On Feb 28, 2010, at 9:37 PM, Steve Piercy - Web Site Builder wrote:
>>
>>>[date_difference(date,date($date_of_birth))->year]
>>>
>>>--steve
>>>
>>>
>>>On 3/1/10 at 2:26 PM, [hidden email] (Jolle Carlestam) pronounced:
>>>
>>>>Does anyone know of an age tag?
>>>>  Simple task of inputting two dates and getting the age as result.
>>>>Duration doesn't cut it. When I try, it claims that I'm 51 years old. I'M NOT!!
>>:-)
>>>>This might be the year I will turn 51 but we're not there yet.
>>>>  Tried Tagswap without success.
>>>>Can't be the first needing this kind of calculation.
>>>>  HDB
>>>>Jolle
>>>>  --
>>>>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/
>>>>
>>>
>>>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>>Steve Piercy               Web Site Builder               Soquel, CA
>>><[hidden email]>                  <http://www.StevePiercy.com/>
>>>
>>>
>>>--
>>>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/
>>>
>>>
>>
>>Brian Loomis
>>http://www.virtualrelations.us
>>(208) 639-2569 - 208 NEW BLOX
>>-- email checked daily --
>>
>>
>>--
>>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/
>>
>>
>
>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>Steve Piercy               Web Site Builder               Soquel, CA
><[hidden email]>                  <http://www.StevePiercy.com/>
>
>
>--
>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/
>
>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
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/


123