Solved

Form time to number

Posted on 2002-06-04
3
206 Views
Last Modified: 2006-11-17
Hello,

My question is how to convert a time value into a number
so 8:40 into 8,6667

0
Comment
Question by:LBH
[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 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7053502
try this:

cdbl(datepart("n", yourfield)) + 60/cdbl(datepart("s", yourfield))

CHeers
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 50 total points
ID: 7053535
even easier:

Dim MyTime as Double

MyTime = CDbl(#8:40#) * 24

whcih you display the value of MyTime, it will show 8.6666667

The trick is to realize that a Date (or Time) is stored internally as a DOUBLE precision Decimal value, with the Decimal part being the fraction of 1 24-hour day.

So convert the Time value to a Double, and then Multiply by 24 to get hours and fractions of an hour.

Arthur Wood
0
 

Author Comment

by:LBH
ID: 7055790
If i apply the suggestion of angellll is get the #error? value.

And where do i have to apply the suggestion of Arthur Wood, create a new module ? The (#8:40#) do i have to replace that with the field name where the time is stored ?

I hope anyone can help me !
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

617 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