Showing time left
Posted on 2011-03-24
Given a future date/time variable (function input), how can I output how much time is left in this format...
"2 years, 3 months, 4 days, 11 hours, 20 minutes and 10 seconds remaining."
To go 1 step further, I would like to have several boolean input variables for the function, like...
bShowYears as boolean, bShowMonths as boolean, bShowDays as boolean
So if they turn bShowYears to false then the "months" would reflect this and the out put would be (using the same example)....
"27 months, 4 days, 11 hours, 20 minutes and 10 seconds remaining."
Please provide sample code in vb.net. Thanks