Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

date time manipulation

Posted on 1999-07-19
2
Medium Priority
?
134 Views
Last Modified: 2012-05-04
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
Comment
Question by:turloughm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 18

Accepted Solution

by:
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

by:deighton
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question