Page 1 of 1

Calculation on DATE

Posted: Sun Sep 11, 2005 9:38 pm
by benny.lbs
Can anyone help on the following case. Thanks a lot!!!

I have a date field and want to calculate the date after 24 month, does any function exist in Transformer or any other else ?

Re: Calculation on DATE

Posted: Mon Sep 12, 2005 12:20 am
by rumu
benny.lbs wrote:Can anyone help on the following case. Thanks a lot!!!

I have a date field and want to calculate the date after 24 month, does any function exist in Transformer or any other else ?
Hi,
There is a custom routine called "AddMonthsToCurrentMonth(%Arg1%, %Arg2%)".Here u need to extract month part from ur date field and use it as Arg1 and in Arg2 use 24.

Re: Calculation on DATE

Posted: Mon Sep 12, 2005 12:58 am
by benny.lbs
rumu, thanks for your reply, but where can I find/call this routine ?
rumu wrote:
benny.lbs wrote:Can anyone help on the following case. Thanks a lot!!!

I have a date field and want to calculate the date after 24 month, does any function exist in Transformer or any other else ?
Hi,
There is a custom routine called "AddMonthsToCurrentMonth(%Arg1%, %Arg2%)".Here u need to extract month part from ur date field and use it as Arg1 and in Arg2 use 24.

Re: Calculation on DATE

Posted: Mon Sep 12, 2005 2:02 am
by rumu
benny.lbs wrote:rumu, thanks for your reply, but where can I find/call this routine ?
rumu wrote:
benny.lbs wrote:Can anyone help on the following case. Thanks a lot!!!

I have a date field and want to calculate the date after 24 month, does any function exist in Transformer or any other else ?
Hi,
There is a custom routine called "AddMonthsToCurrentMonth(%Arg1%, %Arg2%)".Here u need to extract month part from ur date field and use it as Arg1 and in Arg2 use 24.
You will find it under Ruotine/custum folder.Try it using Manager.

Re: Calculation on DATE

Posted: Mon Sep 12, 2005 2:51 am
by benny.lbs
The path does NOT exist :<
rumu wrote:You will find it under Ruotine/custum folder.Try it using Manager.

Posted: Mon Sep 12, 2005 11:00 am
by pnchowdary
Hi Benny,

I think that rumu meant Routines/Custom, further the routine AddMonthsToCurrentMonth seems like a custom routine which they developed themselves. Therfore you will not find it.

Your best bet would be to implement your own logic using the combination of Iconv and Oconv functions.

Posted: Thu Sep 15, 2005 9:02 am
by als110
I have done this first by converting the date to a julian day and since you wanted to know 24 months ahead add 730 to the julian date and then convert if back to date. It is a crazy work around but it works for what you need

Posted: Thu Sep 15, 2005 4:02 pm
by ray.wurlod
What about leap years?

For 24 months wouldn't it be easier to add 2 to the year component, then roll back one day if the result is 29 Feb?

This algorithm fails for the year 2BC but otherwise is OK. You could build in a check for this if you are likely to process dates in that range.