Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 3rd, 2004, 12:13 AM
swasir swasir is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 swasir User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Hours Calculation

I have two fields (Start Time and End Time). If i want to calculate the number of hours on dates basis, how can i do that?

example... start time is 21/07/04 6 PM and End time is 22/07/04 6 AM
what should i do to get 6 hours if the date is >= 22/07/04


Please help

Reply With Quote
  #2  
Old August 3rd, 2004, 05:40 AM
ineuw ineuw is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 82 ineuw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 28 sec
Reputation Power: 5
Date and time are double numbers where the date is the integer and time is the fraction. Convert the begin date and time separately and add them together and do the same with the end date and time. Subtract the Begin date/time from the End Date/time and you get the difference which can be reconverted to date and time format.

I am enclosing a simple function to test
date and time values.

Private Function fnDateAsDoubleTest()

Dim varDate As Variant, varTime As Variant

varDate = Date: varTime = "08:02 AM"

dblDateAndTime = CDbl(varDate) + Format(CDbl(CDate(varTime)), "#.######")
Debug.Print Format(CDbl(CDate(varTime)), "#.######")
Debug.Print varDate
Debug.Print CDbl(varDate)
Debug.Print dblDateAndTime

End Function

I hope this helps.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Hours Calculation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT