In article <a5a4659c4c.B21306@...>,
<B21306@...> wrote:
> --------------------------
> def proc age_show
> if r_froster_card.g_date <1
> r_froster_card.g_age = 0
> else
> r_froster_card.g_age = (@date-r_froster_card.g_date)
> endif
> if @date < r_froster_card.g_date
> r_froster_card.g_age = 0
> endif
> return r_froster_card.g_age
> enddef
> ------------------------------------------------
> I will look for a another solution again.
> Thank You very much for Your help Wim !!
It looks to me Hans, that with your formula of
(@date - r_froster_card.g_date)
you are trying to subtract one date from another date. The answer does not
(usually) make sense, because S-Base will format the result as a date
also, based on a starting date of 24th November -4713. For example, if I
try to subtract the first of January this year from today's date I get
print (@date - @timefoy(@date))
02/03/-4712
instead of 99, which is the number of days between the two dates.
If you use @int(@date - r_froster_card.g_date) instead, you will force the
^^^^
result to be an integer, which you can then manipulate as you wish.
I have never been able to get the data-type sub-type (time/date interval)
to make any sense. On the occasions when I've needed to display a time
interval, I have usually found it best to extract the difference in days
(as above), then convert that into a string such as "00y 04m 09d" or
however you want it using my own function depending on what I want.
I have attached a couple of functions to this email for you to try out.
They are attached rather than included within the body as some of the
lines are a bit long, and may get formatted into multiple lines by your
email reader. Both the functions can be made much shorter once you
understand how they work.
> A Happy Easter for All say
> Hans-Juergen Barthelmehs
A Happy Easter to you too.
Regards,
--
Robin Hampshire
robin@...