VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



I have found the DateDiff command to be very useful for working with dates but unfortunately there

by Roderick Thompson (12 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 18th April 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

I have found the DateDiff command to be very useful for working with dates but unfortunately there doesnt seem to be a TimeDiff function for

Rate I have found the DateDiff command to be very useful for working with dates but unfortunately there



    '(C) Roderick Thompson, April 2001, KLIK4.COM Limited
    Time1 = FormatDateTime(Time1, vbLongTime)
    Time2 = FormatDateTime(Time2, vbLongTime)
    HourTime1 = Hour(Time1)
    HourTime2 = Hour(Time2)
    MinuteTime1 = Minute(Time1)
    MinuteTime2 = Minute(Time2)
    SecondTime1 = Second(Time1)
    SecondTime2 = Second(Time2)
    Time1InSeconds = SecondTime1 + (MinuteTime1 * 60) + (HourTime1 * 3600)
    Time2InSeconds = SecondTime2 + (MinuteTime2 * 60) + (HourTime2 * 3600)
    TimeDifference = Time2InSeconds - Time1InSeconds
    Select Case Interval
        Case "h"
            TimeDifference = TimeDifference / 3600
        Case "m"
            TimeDifference = TimeDifference / 60
    End Select
    TimeDiff = TimeDifference
End Function

Download this snippet    Add to My Saved Code

I have found the DateDiff command to be very useful for working with dates but unfortunately there Comments

No comments have been posted about I have found the DateDiff command to be very useful for working with dates but unfortunately there . Why not be the first to post a comment about I have found the DateDiff command to be very useful for working with dates but unfortunately there .

Post your comment

Subject:
Message:
0/1000 characters