transform Hours into minutes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

transform Hours into minutes

Valerie Guille-2
Hi all,
 
I have been trying to transform hours into minutes for a while now, w/o
any success. So I hope that someone could help me.
Here my problem, I have data in hours format (e.g: 5:20, 6:32 etc.) and
I want to transform them into minutes (e.g: 5:20 = 320 min; 6:32 = 392
min etc.)
Thanks in advance for your time,
 
Val

====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: transform Hours into minutes

ariel barak
Hi Val,

I think this should do it...assume that the date variable you are trying to
convert is named time1.

COMPUTE time1inminutes=(XDATE.HOUR(time1)*60)+XDATE.MINUTE(time1).
EXE.

So, the first part extracts the number of hours in the variable time1 and
then multiples it by 60 to get the number of minutes represented by the
number of hours. The second part pulls out 45 minutes out of 2:45.

To see it in more steps, you can do this:

COMPUTE timehour=XDATE.HOUR(time1)*60.
COMPUTE timeminute=XDATE.MINUTE(time1).
COMPUTE time1inminutes=timehour+timeminute.
EXE.

DELETE VARIABLES timehour timeminute.

Hope that makes sense,
Ari


On Mon, Jul 14, 2008 at 6:32 PM, Valerie Guille <
[hidden email]> wrote:

> Hi all,
>
> I have been trying to transform hours into minutes for a while now, w/o
> any success. So I hope that someone could help me.
> Here my problem, I have data in hours format (e.g: 5:20, 6:32 etc.) and
> I want to transform them into minutes (e.g: 5:20 = 320 min; 6:32 = 392
> min etc.)
> Thanks in advance for your time,
>
> Val
>
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD