The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
How to round an HMS number? [SOLVED]
01-01-2018, 04:53 PM (This post was last modified: 07-21-2018 09:56 AM by JMB.)
Post: #1
How to round an HMS number? [SOLVED]
I'd like to know if it is posible to round the seconds in a number written in HMS format.

Here is an example. I'd like to round the number 15º16'16.99968" to 15º16'17". The function ROUND produces the following results:

ROUND(15º16'16.99968", 0) -> 15º00'00"
ROUND(15º16'16.99968", 1) -> 15º18'00"
ROUND(15º16'16.99968", 2) -> 15º16'12"
ROUND(15º16'16.99968", 3) -> 15º16'15.6"
ROUND(15º16'16.99968", 4) -> 15º16'17.04"

It seams that ROUND first converts 15º16'16.99968" to its decimal equivalent 15.2713888, then rounds this value to the specified number of decimal places (for example for 3 decimal places -> 15.271) and then converts this value back to the HMS format (15º16'15.6")

So, does anyone know how to get 15º16'17"?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
How to round an HMS number? [SOLVED] - JMB - 01-01-2018 04:53 PM
RE: How to round an HMS number? - salvomic - 01-01-2018, 05:01 PM
RE: How to round an HMS number? - JMB - 01-01-2018, 05:58 PM
RE: How to round an HMS number? - salvomic - 01-01-2018, 05:59 PM
RE: How to round an HMS number? - JMB - 01-01-2018, 06:15 PM



User(s) browsing this thread: 1 Guest(s)