Solved

# date time manipulation

Posted on 1999-07-19
Medium Priority
136 Views
Hello
I have a (start date & start time) and a (finish date & finish time) ,I need to calculate the number of hours between each.
Cheers Turlough
0
Question by:turloughm
• 2

LVL 18

Accepted Solution

deighton earned 200 total points
ID: 1525754
Dim x As Date, y As Date, hours

x = Now
y = Now + 10

hours = DateDiff("h", x, y)

MsgBox hours
0

LVL 18

Expert Comment

ID: 1525755
Dim Tstart As Date
Dim Tend  As Date

Dim sdate1 As String
Dim stime1 As String
Dim sdate2 As String
Dim stime2 As String

sdate1 = "23/04/66"
stime1 = "10:10:05"
Here is a more thorough example.  Check your date format settings, locale etc.

sdate2 = "24/04/66"
stime2 = "11:25:02"

Tstart = CDate(sdate1 & " " & stime1)
Tend = CDate(sdate2 & " " & stime2)

MsgBox DateDiff("h", Tstart, Tend)

0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.