PC Review


Reply
Thread Tools Rate Thread

Converting Total Minutes into Days, Hours & Minutes

 
 
=?Utf-8?B?Uk1DREQ5OTc=?=
Guest
Posts: n/a
 
      11th Nov 2006
I would like to create my own vacation db. 1 day = 8 hours. I want to track
my Vacation Time, Compt Time & Personal Time. Each displays the total minutes
I have available. Minutes are my smallest unit of measurement.
Q1 - How do I take my total minutes (25320.0) and display it as: 52-days,
6-hours, 0-minutes?
Q2 - Time used is subtracted in this order: from Compt Time, Personal
time, then Vacation time. How would this be set up.

Thanks again for all you.
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      11th Nov 2006
A1

Function FormatMinutes(TotalMinutes As Long) As String

Dim lngDays As Long
Dim lngHours As Long
Dim lngHoursAndMinutes As Long

lngDays = TotalMinutes \ 480
lngHoursAndMinutes = TotalMinutes Mod 480
lngHours = lngHoursAndMinutes \ 60

FormatMinutes = lngDays & "-Days, " & _
lngHours & "-Hours, " & _
lngHoursAndMinutes - (lngHours * 60) & "-minutes"

End Function

A2

Afraid I don't understand the question. Can you give an example to clarify
what you mean?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"RMCDD997" <(E-Mail Removed)> wrote in message
news:9F8E4501-2AFF-433A-A5C7-(E-Mail Removed)...
>I would like to create my own vacation db. 1 day = 8 hours. I want to track
> my Vacation Time, Compt Time & Personal Time. Each displays the total
> minutes
> I have available. Minutes are my smallest unit of measurement.
> Q1 - How do I take my total minutes (25320.0) and display it as:
> 52-days,
> 6-hours, 0-minutes?
> Q2 - Time used is subtracted in this order: from Compt Time, Personal
> time, then Vacation time. How would this be set up.
>
> Thanks again for all you.



 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      11th Nov 2006
Try this. Watch out for Word wrap:

Function DayHourMin(varMin As Variant)

Dim lngTotalHours As Long
Dim lngTotalMins As Long
Dim lngDays As Long
Dim lngHours As Long
Dim lngMin As Long

varMin = varMin / 1440

lngDays = Int(CSng(varMin))
lngTotalHours = Int(CSng(varMin * 24))
lngTotalMins = Int(CSng(varMin * 1440))
lngHours = lngTotalHours Mod 24
lngMin = lngTotalMins Mod 60

DayHourMin = lngDays & " Days " & lngHours & " Hours " & lngMin & " Minutes"

End Function
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"RMCDD997" <(E-Mail Removed)> wrote in message
news:9F8E4501-2AFF-433A-A5C7-(E-Mail Removed)...
>I would like to create my own vacation db. 1 day = 8 hours. I want to track
> my Vacation Time, Compt Time & Personal Time. Each displays the total
> minutes
> I have available. Minutes are my smallest unit of measurement.
> Q1 - How do I take my total minutes (25320.0) and display it as:
> 52-days,
> 6-hours, 0-minutes?
> Q2 - Time used is subtracted in this order: from Compt Time, Personal
> time, then Vacation time. How would this be set up.
>
> Thanks again for all you.



 
Reply With Quote
 
=?Utf-8?B?Uk1DREQ5OTc=?=
Guest
Posts: n/a
 
      12th Nov 2006
Thanks for responding Douglas, I appreciate your assistance. Maybe this will
help. Example: I currently have
Vacation: 5-days, 6-hours, 0-minutes
Personal: 0-days, 2-hours, 0-minutes
Compt: 0-days, 2-hours, 0-mintues

I use 6 hours - which shoud be deducted from compt, personal, then vacation
leaving the balance of:
Vacation: 6-days, 4-hours, 0-minutes
Personal: 0-days, 0-hours, 0-minutes
Compt: 0-days, 0-hours, 0-mintues
Thanks Again

"Douglas J. Steele" wrote:

> A1
>
> Function FormatMinutes(TotalMinutes As Long) As String
>
> Dim lngDays As Long
> Dim lngHours As Long
> Dim lngHoursAndMinutes As Long
>
> lngDays = TotalMinutes \ 480
> lngHoursAndMinutes = TotalMinutes Mod 480
> lngHours = lngHoursAndMinutes \ 60
>
> FormatMinutes = lngDays & "-Days, " & _
> lngHours & "-Hours, " & _
> lngHoursAndMinutes - (lngHours * 60) & "-minutes"
>
> End Function
>
> A2
>
> Afraid I don't understand the question. Can you give an example to clarify
> what you mean?
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "RMCDD997" <(E-Mail Removed)> wrote in message
> news:9F8E4501-2AFF-433A-A5C7-(E-Mail Removed)...
> >I would like to create my own vacation db. 1 day = 8 hours. I want to track
> > my Vacation Time, Compt Time & Personal Time. Each displays the total
> > minutes
> > I have available. Minutes are my smallest unit of measurement.
> > Q1 - How do I take my total minutes (25320.0) and display it as:
> > 52-days,
> > 6-hours, 0-minutes?
> > Q2 - Time used is subtracted in this order: from Compt Time, Personal
> > time, then Vacation time. How would this be set up.
> >
> > Thanks again for all you.

>
>
>

 
Reply With Quote
 
=?Utf-8?B?Uk1DREQ5OTc=?=
Guest
Posts: n/a
 
      12th Nov 2006
Thanks Arvin, I will try it now.

"Arvin Meyer [MVP]" wrote:

> Try this. Watch out for Word wrap:
>
> Function DayHourMin(varMin As Variant)
>
> Dim lngTotalHours As Long
> Dim lngTotalMins As Long
> Dim lngDays As Long
> Dim lngHours As Long
> Dim lngMin As Long
>
> varMin = varMin / 1440
>
> lngDays = Int(CSng(varMin))
> lngTotalHours = Int(CSng(varMin * 24))
> lngTotalMins = Int(CSng(varMin * 1440))
> lngHours = lngTotalHours Mod 24
> lngMin = lngTotalMins Mod 60
>
> DayHourMin = lngDays & " Days " & lngHours & " Hours " & lngMin & " Minutes"
>
> End Function
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "RMCDD997" <(E-Mail Removed)> wrote in message
> news:9F8E4501-2AFF-433A-A5C7-(E-Mail Removed)...
> >I would like to create my own vacation db. 1 day = 8 hours. I want to track
> > my Vacation Time, Compt Time & Personal Time. Each displays the total
> > minutes
> > I have available. Minutes are my smallest unit of measurement.
> > Q1 - How do I take my total minutes (25320.0) and display it as:
> > 52-days,
> > 6-hours, 0-minutes?
> > Q2 - Time used is subtracted in this order: from Compt Time, Personal
> > time, then Vacation time. How would this be set up.
> >
> > Thanks again for all you.

>
>
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      12th Nov 2006
I assume that's an error in your example: that what's left as vacation
should be Vacation: 5-days, 4-hours, 0-minutes, not 6-days, 4-hours,
0-minutes.

What do your tables look like? Hopefully Vacation, Personal and Compt aren't
stored as day, hours, minutes, but strictly total minutes. (Also, hopefully
they aren't 3 separate fields in the same table)

In essence, you're going to have to use VBA to figure out what to do.

Assuming what you used is stored in a variable lngUsed, you need something
like the following pseudocode:

If Compt >= lngUsed Then
Compt = Compt - lngUsed
lngUsed = 0
Else
lngUsed = lngUsed - Compt
Compt = 0
If Personal >= lngUsed Then
Personal = Personal - lngUsed
lngUsed = 0
Else
lngUsed = lngUsed - Personal
Person = 0
If Vacation >= lngUsed Then
Vacation = Vacation - lngUsed
lngUsed = 0
Else
lngUsed = lngUsed - Vacation
Vacation = 0
End If
End If
End If

If lngUsed > 0 Then
MsgBox "Not everything could be allocated"
End If

That's about the best I can do without knowing more about your setup.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"RMCDD997" <(E-Mail Removed)> wrote in message
news:045A779B-DF71-4F09-92AA-(E-Mail Removed)...
> Thanks for responding Douglas, I appreciate your assistance. Maybe this
> will
> help. Example: I currently have
> Vacation: 5-days, 6-hours, 0-minutes
> Personal: 0-days, 2-hours, 0-minutes
> Compt: 0-days, 2-hours, 0-mintues
>
> I use 6 hours - which shoud be deducted from compt, personal, then
> vacation
> leaving the balance of:
> Vacation: 6-days, 4-hours, 0-minutes
> Personal: 0-days, 0-hours, 0-minutes
> Compt: 0-days, 0-hours, 0-mintues
> Thanks Again
>
> "Douglas J. Steele" wrote:
>
>> A1
>>
>> Function FormatMinutes(TotalMinutes As Long) As String
>>
>> Dim lngDays As Long
>> Dim lngHours As Long
>> Dim lngHoursAndMinutes As Long
>>
>> lngDays = TotalMinutes \ 480
>> lngHoursAndMinutes = TotalMinutes Mod 480
>> lngHours = lngHoursAndMinutes \ 60
>>
>> FormatMinutes = lngDays & "-Days, " & _
>> lngHours & "-Hours, " & _
>> lngHoursAndMinutes - (lngHours * 60) & "-minutes"
>>
>> End Function
>>
>> A2
>>
>> Afraid I don't understand the question. Can you give an example to
>> clarify
>> what you mean?
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "RMCDD997" <(E-Mail Removed)> wrote in message
>> news:9F8E4501-2AFF-433A-A5C7-(E-Mail Removed)...
>> >I would like to create my own vacation db. 1 day = 8 hours. I want to
>> >track
>> > my Vacation Time, Compt Time & Personal Time. Each displays the total
>> > minutes
>> > I have available. Minutes are my smallest unit of measurement.
>> > Q1 - How do I take my total minutes (25320.0) and display it as:
>> > 52-days,
>> > 6-hours, 0-minutes?
>> > Q2 - Time used is subtracted in this order: from Compt Time, Personal
>> > time, then Vacation time. How would this be set up.
>> >
>> > Thanks again for all you.

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Converting total minutes into hours and minutes in Excel sjames Microsoft Excel Worksheet Functions 0 26th Dec 2007 07:24 PM
RE: Converting total minutes into hours and minutes in Excel sjames Microsoft Excel Worksheet Functions 0 26th Dec 2007 07:21 PM
RE: Converting total minutes into hours and minutes in Excel =?Utf-8?B?VGVldGhsZXNzIG1hbWE=?= Microsoft Excel Worksheet Functions 0 21st Dec 2006 11:35 PM
converting Days Hours & minutes into just minutes in excel =?Utf-8?B?U2l4IFNpZ21hIEJsYWNrYmVsdA==?= Microsoft Excel Misc 5 28th Apr 2006 09:45 PM
Display Total Minutes in Days:Hours:Minutes =?Utf-8?B?Y2JqYW1lcw==?= Microsoft Access 5 16th Jan 2006 04:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:44 AM.