Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: JAVA/PHP Rounding Numbers

  1. #1
    Join Date
    Jul 2010
    Posts
    14
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default JAVA/PHP Rounding Numbers

    Got another question, I asked on another forum, (HTML), I was told what I wanted to do couldn't be done under HTML, but Java or PHP it was possible.

    I'm looking for a way to round off numbers.

    My Temperature reading for my station come out as : 95.5F



    I'd like to round it to 96F instead, how do I write this in Java or PHP?

    HTML Code:
    <html>
    <body bgcolor=#000054>
    <font face="Digiface" size="12" color="#00FF00">%[outdoor_temperature]deg_F%&deg F</font>
    </background>
    </body>
    </html>
    Thanks ahead of time for any and all help, it is Greatly Appreciated!

    GulfBreeze

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    What is "%[outdoor_temperature]deg_F%&deg F"/ where does it come from?
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Jul 2010
    Posts
    14
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default WS Variables

    Quote Originally Posted by bluewalrus View Post
    What is "%[outdoor_temperature]deg_F%&deg F"/ where does it come from?
    * NOTE WS=Weather Station

    This is a variable assigned by the Lacrosse WS, for use with the WUHU program.

    You can assign these variables as shown in the HTML script above.

    Variables may be used in an html, php, java, or other types of files.

    Once you have the script of choice, these files are then loaded by the WUHU ftp program,and the variable is then read in from the WS. Then uploaded to the website.

    GB

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Which are you using html, php, java, or another? Please post all the code that is being used to generate the temperature?
    Corrections to my coding/thoughts welcome.

  5. #5
    Join Date
    Jul 2010
    Posts
    14
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re; Which Code Format

    The above HTML format is what is currently being used, on my website. All I'm looking to do is find some way to round off the Temperature.

    I not versed at php or java scripts...but since you say this is the only way in which I can round off the digits, that's what I trying to figure out.

    Not sure which would be easier write php or java...I went to the site link you posted on PHP, and am in the process of reading the online manual...but it reads like stereo instructions

    If your asking which format, I prefer..either Java or PHP will work...

    GB

  6. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    As bluewalrus said, we need to see all the code/script thats generating the temperature so we can see the variables, etc. in context.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  7. #7
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I'm not asking which you prefer but what is being used to convert from this %[outdoor_temperature]deg_F%&deg F to 95.5║F because %[outdoor_temperature]deg_F%&deg F is not html. If you dont know what it is but can provide us with a link that could also work.
    Corrections to my coding/thoughts welcome.

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    To help clarify: you are already using a programming language, and in order to help you we will need to know which one. It's not possible to help without knowing what code you already have.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Jul 2010
    Posts
    14
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    Ok, let me back track...the %OutdoorTempDeg% is just a variable.
    When used with the WUHU program, and a weatherstation, it inserts the current temperature from the weather station into this variable.

    The coding in my original post is the one in current use on my website. Waveland Weather Center

    I realize the original coding is in html, but when I asked how to round the number in html, I was told it was not possible, and that I should look at writing it in Java or Php.

    So what I trying to do is rewrite my current HTML coding (listed in the original post) in either Java or Php, so that the Temperature is rounded to the closest whole number.

    Hope this helps, and thank you for the quick response!

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    HTML simply cannot do this by itself. There MUST already be another language in use for that variable to become a number and not be displayed as plain text. HTML does not use variables. What language is converting that variable to a number?
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •