to derive the time
Author Message
to derive the time

Hi all

Please anybody can help to solve the probelm to derive the time from a table
having the column 'minitus'. In this column I am storing  the minitus as
follows
.30
.40
.50
.40
.30

I have to find out the total minitus taken for a period

Select sum(minitus) into :ldec_minitus
from attendance
where datefrom >= #01-01-2009# and dateto <= #12-01-2009#

ldec_minitus = 20.50 . But it is not actual time . I need to convert into
hrs and minitus by using 60. So please anybody can help me to derive the hrs
and minitus from a total figures by using 60.

With thanks and Regards

Pol

Sat, 29 Oct 2011 00:34:02 GMT
to derive the time

Quote:
> Please anybody can help to solve the probelm to derive the time from a table
> having the column 'minitus'. In this column I am storing  the minitus as
> follows
> .30
> .40
> .50
> .40
> .30

> I have to find out the total minitus taken for a period

What is a mintus?

You did not say if those values represent seconds, or fractions of
a minute.  Does .50 mean 50 seconds, or is .50 one half of a minute?

If those are seconds, then .50 actually means 50 seconds, and 20.50
actually means 2050 seconds.  If you know how many seconds have
elapsed, you can easily find the number of minutes by dividing by 60.

Where:

seconds = 2050 Mod 60                ' 10
minutes = (2050 - seconds) / 60     ' 34

Yields a result of 34:10.

HTH
LFS

Sat, 29 Oct 2011 01:43:15 GMT
to derive the time
If the figures in your table are actually minutes (eg, 0.50 means half a
minute or 30 seconds) then your total is minutes and a decimal fraction of a
minute.  So elapsed time would be:

Minutes = Int(Total)
Seconds = (Total - Minutes) * 60

If the minutes could be greater than 60 then you need to break minutes into
hours and minutes.

Hours = Minutes \ 60
Minutes = Minutes - (Hours * 60)

Quote:
> Hi all

> Please anybody can help to solve the probelm to derive the time from a
> table
> having the column 'minitus'. In this column I am storing  the minitus as
> follows
> .30
> .40
> .50
> .40
> .30

> I have to find out the total minitus taken for a period

> Select sum(minitus) into :ldec_minitus
> from attendance
> where datefrom >= #01-01-2009# and dateto <= #12-01-2009#

> ldec_minitus = 20.50 . But it is not actual time . I need to convert into
> hrs and minitus by using 60. So please anybody can help me to derive the
> hrs
> and minitus from a total figures by using 60.

> With thanks and Regards

> Pol

Sat, 29 Oct 2011 10:41:45 GMT
to derive the time
Please let me give one more answer

if my database having  the following minitus stored

.60
.60
.60
.60
.60
.50

From the above mathod how I can derive the exact time  after summing up the
total
as .350 . Please let me know

With regards

Pol

Quote:

> Hi all

> Please anybody can help to solve the probelm to derive the time from a table
> having the column 'minitus'. In this column I am storing  the minitus as
> follows
> .30
> .40
> .50
> .40
> .30

> I have to find out the total minitus taken for a period

> Select sum(minitus) into :ldec_minitus
> from attendance
> where datefrom >= #01-01-2009# and dateto <= #12-01-2009#

> ldec_minitus = 20.50 . But it is not actual time . I need to convert into
> hrs and minitus by using 60. So please anybody can help me to derive the hrs
> and minitus from a total figures by using 60.

> With thanks and Regards

> Pol

Sat, 29 Oct 2011 14:20:01 GMT
to derive the time
You probably should be storing these numbers in a date/time field as such
00:00:30 then all you would neen to do is use the a DateAdd function to do
the addition.

--
Randem Systems
Your Installation Specialist
The Top Inno Setup Script Generator
http://www.randem.com/innoscript.html
Disk Read Error Press Ctl+Alt+Del to Restart
http://www.randem.com/discus/messages/9402/9406.html?1236319938

Quote:
> Please let me give one more answer

> if my database having  the following minitus stored

> .60
> .60
> .60
> .60
> .60
> .50

> From the above mathod how I can derive the exact time  after summing up
> the
> total
> as .350 . Please let me know

> With regards

> Pol

>> Hi all

>> Please anybody can help to solve the probelm to derive the time from a
>> table
>> having the column 'minitus'. In this column I am storing  the minitus as
>> follows
>> .30
>> .40
>> .50
>> .40
>> .30

>> I have to find out the total minitus taken for a period

>> Select sum(minitus) into :ldec_minitus
>> from attendance
>> where datefrom >= #01-01-2009# and dateto <= #12-01-2009#

>> ldec_minitus = 20.50 . But it is not actual time . I need to convert into
>> hrs and minitus by using 60. So please anybody can help me to derive the
>> hrs
>> and minitus from a total figures by using 60.

>> With thanks and Regards

>> Pol

Sat, 29 Oct 2011 14:37:19 GMT
to derive the time

Quote:
> Please let me give one more answer

> if my database having  the following minitus stored

> .60
> .60
> .60
> .60
> .60
> .50

> From the above mathod how I can derive the exact time  after summing up
the
> total
> as .350 . Please let me know

> With regards

> Pol

Public Function FormatMinutes(TotalMinutes As Variant) As String
Dim lHours     As Long
Dim lMinutes   As Long

' to handle that odd use of decimal
TotalMinutes = Replace(TotalMinutes, ".", "")

If TotalMinutes >= 60 Then
lHours = TotalMinutes \ 60
lMinutes = TotalMinutes Mod 60
Else
lMinutes = TotalMinutes
End If

FormatMinutes = Format\$(lHours, "00.") & Format\$(lMinutes, "00")

End Function

Sat, 29 Oct 2011 15:27:27 GMT
to derive the time
thanks a lot. It was helpful
Quote:

> > Please let me give one more answer

> > if my database having  the following minitus stored

> > .60
> > .60
> > .60
> > .60
> > .60
> > .50

> > From the above mathod how I can derive the exact time  after summing up
> the
> > total
> > as .350 . Please let me know

> > With regards

> > Pol

> Public Function FormatMinutes(TotalMinutes As Variant) As String
>     Dim lHours     As Long
>     Dim lMinutes   As Long

>          ' to handle that odd use of decimal
>     TotalMinutes = Replace(TotalMinutes, ".", "")

>     If TotalMinutes >= 60 Then
>         lHours = TotalMinutes \ 60
>         lMinutes = TotalMinutes Mod 60
>     Else
>         lMinutes = TotalMinutes
>     End If

>     FormatMinutes = Format\$(lHours, "00.") & Format\$(lMinutes, "00")

> End Function

Sat, 29 Oct 2011 19:55:01 GMT

 Page 1 of 1 [ 7 post ]

Relevant Pages

Powered by phpBB® Forum Software