A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to convert hours into minutes



 
 
Thread Tools Display Modes
  #1  
Old February 7th, 2007, 05:42 PM posted to microsoft.public.access.tablesdbdesign
CMTH
external usenet poster
 
Posts: 24
Default How to convert hours into minutes

How would I convert total hours into minutes?
For exampl: 2:10 into 130 minutes
  #2  
Old February 7th, 2007, 06:16 PM posted to microsoft.public.access.tablesdbdesign
Tim Ferguson
external usenet poster
 
Posts: 142
Default How to convert hours into minutes

=?Utf-8?B?Q01USA==?= wrote in
:

How would I convert total hours into minutes?
For exampl: 2:10 into 130 minutes


Public Function ShortTimeToMinutes(timeString As String) As Integer

Dim v As Variant

v = Split(timeString, ":")
If UBound(v, 1) 1 Then
Err.Raise 5, , "Bad short time format"

ElseIf Not IsNumeric(v(0)) Or Not IsNumeric(v(1)) Then
Err.Raise 5, , "Bad short time format"

Else
ShortTimeToMinutes = CInt(v(0)) * 60 + v(1)

End If

End Function


Hope that helps


Tim F

  #3  
Old February 7th, 2007, 06:36 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default How to convert hours into minutes

Where? In a query?

Hours * 60 = minutes.

Regards

Jeff Boyce
Microsoft Office/Access MVP


"CMTH" wrote in message
...
How would I convert total hours into minutes?
For exampl: 2:10 into 130 minutes



  #4  
Old February 7th, 2007, 06:37 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default How to convert hours into minutes

On Wed, 7 Feb 2007 09:42:01 -0800, CMTH
wrote:

How would I convert total hours into minutes?
For exampl: 2:10 into 130 minutes


How are you getting the 2:10?

Note that Access Date/Time values are NOT appropriate for storing
durations; a Date/Time value is actually stored as a Double Float
count of days and fractions of a day since midnight, December 30,
1899. As such, a duration over 24 hours will NOT show as (e.g.) 28:15,
but as #31-Dec-1899 04:15:00#. If you're storing durations at
one-minute granularity, it's usually best to store them in a Long
Integer number field, and use an expression like

[Duration] \ 60 & Format([Duration] MOD 60, ":00")

to display hours and minutes.

John W. Vinson [MVP]
 




Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.