Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old January 19th, 2006, 08:35 PM
BerkshireGuy
Guest
 
Posts: n/a
Default Showing the difference between two times in Hours, Minutes and Seconds

Brendan Reynolds posted the following function a while back ago:

Public Function HoursMinutes( _
dtmStart As Date, _
dtmEnd As Date _
) As String


Dim intHours As Integer
Dim intMinutes As Integer


intMinutes = DateDiff("n", dtmStart, dtmEnd)
intHours = intMinutes \ 60
intMinutes = intMinutes Mod 60
HoursMinutes = CStr(intHours) & " Hours and " & CStr(intMinutes) &
"
minutes."

I was wondering if anyone could modify this so it showed seconds as
well.

Thanks

  #2  
Old January 19th, 2006, 09:35 PM
MGFoster
Guest
 
Posts: n/a
Default Re: Showing the difference between two times in Hours, Minutes andSeconds

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dim intSeconds As Integer

intSeconds = DateDiff("s", dtmSart, dtmEnd)
intHours = intSeconds \ 3600
intMinutes = intSeconds \ 60 mod 60
intSeconds = intSeconds mod 60

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ9AD64echKqOuFEgEQKoQQCgz4oh3h57IQhFYUkMuApBqe iFYr4AoJIP
M/17zicVhHNAvRBudAsnbmp7
=w9sj
-----END PGP SIGNATURE-----


BerkshireGuy wrote:[color=blue]
> Brendan Reynolds posted the following function a while back ago:
>
> Public Function HoursMinutes( _
> dtmStart As Date, _
> dtmEnd As Date _
> ) As String
>
>
> Dim intHours As Integer
> Dim intMinutes As Integer
>
>
> intMinutes = DateDiff("n", dtmStart, dtmEnd)
> intHours = intMinutes \ 60
> intMinutes = intMinutes Mod 60
> HoursMinutes = CStr(intHours) & " Hours and " & CStr(intMinutes) &
> "
> minutes."
>
> I was wondering if anyone could modify this so it showed seconds as
> well.
>
> Thanks
>[/color]
  #3  
Old January 20th, 2006, 03:15 PM
BerkshireGuy
Guest
 
Posts: n/a
Default Re: Showing the difference between two times in Hours, Minutes and Seconds

Thnks MGFoster. Works well.

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles