# New to QlikView

Discussion board where members can get started with QlikView.

Contributor

## Number of days in Month and days

Hi all,

I have a expression where i am finding remaining days  with exression

contractlineenddate - today().

But i want to display no of days as months and days

like 95 days becomes  3 months 5 days.

Can someone pls help me?

Kind Regards

Manu

Contributor

## Re: Number of days in Month and days

I'm going to assume that you don't simply mean (95/30) to show months and then take the remainder as days, that you want to recognise that one of those months is 30 days and the other two might be 31.

This being the case, this syntax in your load script works and produces two fields, a Difference in Months and a Difference in Days.

IF(Day(ContractEndDate)>=Day(CurrentDate)
,((
Year(ContractEndDate)*12)+Month(ContractEndDate)) - ((Year(CurrentDate)*12)+Month(CurrentDate))
,
IF(Day(ContractEndDate)<Day(CurrentDate)
,(((
Year(ContractEndDate)*12)+Month(ContractEndDate)) - ((Year(CurrentDate)*12)+Month(CurrentDate))) - 1
))
AS Difference_NumberOfMonths

IF(Day(ContractEndDate)>=Day(CurrentDate)
,
Day(ContractEndDate) - Day(CurrentDate)
,
IF(Day(ContractEndDate)<Day(CurrentDate)
,
Day(MonthEnd(CurrentDate)) - Day(CurrentDate) + Day(ContractEndDate)
))
AS Difference_NumberOfDays