Re: Calculating a time and date (counting down)
- From: "Steve Gerrard" <mynamehere@xxxxxxxxxxx>
- Date: Sat, 19 Jan 2008 13:03:31 -0800
Rick Rothstein (MVP - VB) wrote:
Below my name is a function I have posted in the past which takes a
single argument, number of seconds, and will return a formatted
String value giving the number of Years, Months, Weeks, Days, Hours,
Minutes and Seconds from Now until that number of seconds has
elapsed. Copy/Paste it into your project and then you can use it in
your Timer's Timer event like this...
Private Sub Timer1_Timer()
Label1.Caption = YMWDHMS(DateDiff("s", Now, DateSerial(2008, 7, 1)))
End Sub
Hey Rick, if you feel like doing some debugging, try
Private Sub Timer1_Timer()
Label1.Caption = YMWDHMS(597660)
End Sub
I get an oscillation between two ways of reporting that:
0 years, 0 months, 0 weeks, 6 days, 22 hours, 1 minute, 0 seconds
0 years, 0 months, 0 weeks, 6 days, 22 hours, 0 minutes, 60 seconds
It has to do with winding up with 1.00000000000016 minutes, which leads to 1
min. 0 sec, or with 0.999999999999943 minutes, which gives 0 min. 60 secs.
I'm sure there are other SecondsIn values that could produce the same result.
.
- Follow-Ups:
- Re: Calculating a time and date (counting down)
- From: Rick Rothstein \(MVP - VB\)
- Re: Calculating a time and date (counting down)
- References:
- Re: Calculating a time and date (counting down)
- From: Rick Rothstein \(MVP - VB\)
- Re: Calculating a time and date (counting down)
- Prev by Date: Re: Interesting
- Next by Date: Re: How's dot.net doing nowadays?
- Previous by thread: Re: Calculating a time and date (counting down)
- Next by thread: Re: Calculating a time and date (counting down)
- Index(es):
Relevant Pages
|