RobertNZana
asked on
Showing time left
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
"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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To make it work how you want you can make it only query the seconds difference and just use math to calculate the rest
ASKER
Can you please extend the example to show what you mean? Thanks.
ASKER
Your code doesn't do what it should. I need it to break it down further. Can anyone assist please?
To simplify, given 2 date/times, return the time left between them in this format....
x years, x months, x weeks, x days, x hours, x minutes, x seconds
Thanks
To simplify, given 2 date/times, return the time left between them in this format....
x years, x months, x weeks, x days, x hours, x minutes, x seconds
Thanks
ASKER
Close but not really.