if i have 1 day..why it is increment to 1 this happens if i have month and days or include all year,months and days..year and day looks fine.2years 2 days=2 years 2days ..or if i enter 1 days only it display as 1 day but 3 months 1 day is display 3months 2 days..or 1year 2months 1 day display as 1 year 2months and 2 days...
please help..
thanks in advance
Code:
Public Function RaceDate(length As Integer ) As String
dim year As string=0
dim month As string=0
dim day As string=0
dim ReturnString As string
ReturnString=""
If length = 0 then
Return String.Empty
end if
if length >=365
year=cstr((Math.Floor (length / 365)))
length =(length Mod 365)
end if
If length >=30 AndAlso length<365 Then
month =(cstr((Math.Floor(length/30))))
length =(length Mod 30)
end if
if length<=30 Then
day =cstr((length))
end if
if cint(year)>0
ReturnString= year+" Years "
end if
if cint(month)>0
ReturnString= ReturnString +month+" Months "
end if
if cint(day)>0
ReturnString=ReturnString+day+" Days "
end if
return(ReturnString)
end Function
please help..
thanks in advance