i want to output 2years.or 2years 3months 6days.rather than 2years 0months and 0days if One of them a zeros 0(s) i dont want to display. ..i have my code below..please can you help me on this..im new to vb..
Public Function GetCustomDate(ByVal days As Int32) As String
Dim timeSpan as System.TimeSpan
'timeSpan = objDate2 - objDate1
Dim objDate1 As DateTime = DateTime.Now()
Dim objDate2 As DateTime = objDate1.AddDays(-1 * days)
Return (objDate1.Year - objDate2.Year)& "Years" &(objDate1.Month - objDate2.Month) &"Months"&(objDate1.Day - objDate2.Day)& " Days"
End Function
thanks

New Topic/Question
Reply



MultiQuote







|