modify code written by another coder vb6

Need this code to accept am/pm time
Dim dteTaskTime As Date
Dim dteTaskTimeTom As Date
Dim dteTimeNow As Date
Dim lngDifference As Long
Dim lngHours As Long
Dim lngMinutes As Long

dteTimeNow = TimeValue(Now)
' This is set up for a 9AM task
dteTaskTime = TimeValue("9:00") ' assumes military time

If dteTimeNow > dteTaskTime Then
    ' Format a date+time value that represents the task time tomorrow
    dteTaskTimeTom = Format(Now + 1, "short date") & " " & dteTaskTime
    lngDifference = Abs(DateDiff("s", dteTaskTimeTom, Now))
Else
    lngDifference = DateDiff("s", dteTimeNow, dteTaskTime)
    lngHours = (lngDifference \ 60) \ 60
    lngMinutes = (lngDifference - (lngHours * 60 * 60)) \ 60
End If

lngHours = (lngDifference \ 60) \ 60
lngMinutes = (lngDifference - (lngHours * 60 * 60)) \ 60
MsgBox "Task due in " & lngHours & " Hours and " & lngMinutes & " Minutes"
isnoend2001Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
I believe I explained how to do that.

Add something like this after the dteTaskTime = TimeValue("9:00") ' assumes military time line.

If <some test that tells you the time is PM> Then
    dteTaskTime = DateAdd("h", 12, dteTaskTime)
End If

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GrahamSkanRetiredCommented:
It seems that there is more to this query than appears in the question, but to answer what is in the text:

TimeValue assumes the 24hour clock unless the letters PM appear at the end, so TimeValue("9:00PM") is the same as TimeValue("21:00").

AM is also acceptable, but up to noon, the 12 and the 24 hour clocks are the same, so there in no overall effect.
isnoend2001Author Commented:
Thanks
thats the part i was not getting: TimeValue
dteTaskTime = TimeValue(9:00AM) would be 9:00
dteTaskTime = TimeValue(9:00PM) would be 21:00
did not realize  TimeValue would do that
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.