Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Years and Months

Status
Not open for further replies.

subbulu

Programmer
Aug 23, 2002
20
US
Hello,
I have a problem with calculating years and months.
How can i calculate Years and Months.
It should display like 1.2.
For example 1 year 2 months is like 1.2
Any Idea pleaz.
I would apprciate for ur quick response.
Thanks in Advance.
 
What product/version are you using? Could you give more details of what you are trying to do?

Thanks
 
Hello CosmicNerd,
Thanks for replying.
I am using Impromptu 6.0.
I am trying to calculate years and months from 2 dates.
Here I am giving you what I am trying to do.

years-between(ifnull-datetime(Adjusted Service Date, Most Recent Hire Date),
datetime-to-date(ifnull-datetime(most Recent Termination Date,now())))

In above calculation I am trying to calculate years and months.
Any Idea pleaz.
I would apprciate for your quick response.
Thanks in Advance.
 
Presumably you've tried just subtracting the dates, can't remember if this works (probably doesn't). What about using date-to-days-from-1900 to convert the two dates to numbers, then subtract one from the other, then convert the result back to a date using days-from-1900-to-date?

There are probably other ways but I can't think of them today!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top