Jump to content

[SOLVED] Convert standard time to decimal time?


Recommended Posts

Hello all and Merry Christmas,

I have a small problem. I have a variable which outputs a time such as "03:27". And I need this hour value outputted as a decimal time. In this scenario, the desired output would be "3.5".

How can this be accomplished?

The variable containing the standard time is called $arData[31]

Thanks for any help.

Regards,

Efrain Ruiz
Another thing, Orio...

If I have a variable that stores a coordinate exactly in this format:

N18 23.5725 W66 23.8565

And I need to change this coordinate into decimal degrees such as this:

18.3928, -66.3976

In the example above, in order to get the .xxxx value, we need to divide xx.xxxx by 60 (ej: 23.5725/60 = .3928). Also, I need to have a comma separating the 2 values.

How can this be accomplished? Keep in mind that the letter W or S, needs to be converted to a - (negative sign)

The name of the variable is $position

Thanks for any help.

Regards,

Efrain Ruiz
[quote author=ted_chou12 link=topic=119891.msg491380#msg491380 date=1167074353]
your 3.5 is rounded? is it suppose to be 3.45 if to exact?
[/quote]

As a matter of fact, 3.45 is more precise and is perfectly fine. ;-) I prefer it not to be rounded.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.