?
Solved

time comparison...

Posted on 1999-01-16
3
Medium Priority
?
129 Views
Last Modified: 2010-05-18
I would like to compare system time with time that has been stored in MS Access database field (of type day/time). my problem is that the time from the database is always in 12 hour clock whereas system time is always in 24 hour clock
0
Comment
Question by:serameng
[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
3 Comments
 
LVL 1

Expert Comment

by:ikxsoft
ID: 1468957
since the minutes are the same in 12 and 24 hour time, all you would have to do is add 12 hours to each hour past and including 12 noon, but before 12 night.
0
 

Author Comment

by:serameng
ID: 1468958
Isn't there another way? You see I get the time from the database and do not necessarily know its value. So I wouldn't know if its 12 noon, 12 night, or whatever. And please give me an example of your solution.
0
 
LVL 10

Accepted Solution

by:
caraf_g earned 20 total points
ID: 1468959
If your time in your database field is stored as a Date/Time field, it isn't actually stored in a particular format. In VB you can simply retrieve it in a variable of type Date

Then, to calculate the difference between dates

Dim datDate1 As Date
Dim datDate2 As Date
Dim dblDiff As Double

dblDiff = datDate2 - datDate1

Now - the integer portion of dblDiff is the difference between datDate2 and datDate1 in days, but the fraction is the difference in fractions of a day.

So to calculate the difference in minutes
dblDiff = dblDiff * 24 'There are 24 hours in the day
dblDiff = dblDiff * 60 'There are 60 minutes in an hour


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

719 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