Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Java Programming Tutorial - 37 - Display Regular time

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
85,352
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 2, 2009

How to display time for normal people

  • likes, 11 dislikes

Link to this comment:

Share to:

Top Comments

  • *me at class 1* "this is gonna be awesome! :D"

    *me at class 37* "my head hurts, i hate this shit, i need an aspirin, but i won't give up!" xD

  • I called the variable for this "toWeirdAmerican". AM, PM, impossibly cluttered way of counting time imo.

    On Earth the 'normal' way to keep track of time is what americans call "military".

see all

All Comments (246)

Sign In or Sign Up now to post a comment!
  • @sporreking

    Yeah, doesn't it just bother you when people living in a particular country have a world perspective associated with that country? It's almost like their environment plays a role in their growing understanding of the world around them!

    You know what I am tired of? Bigots like you who jump at any opportunity to bash on somebody for holding a different world perspective than your own. So thenewboston considers strange what you consider normal? Get the fuck over it.

  • Ayo04Soul: facepalm

  • @Ayo04Soul so you downloaded eclipse and extracted it to a place on your computer? then ran it from its .exe file? oh and you might wanna go download java again.

  • I've got to lesson 37 and so far no problem with the programming. However, I wasn't able to successfully set up the Java environment or get Eclipse. working :-(.

    So can you help with this.

    I'm working with a Notebook (easy to carry around), running Microsoft windows XP home edition. I have previously downloaded Jre 1.5.0.

    I tried the steps you mentioned but nothing ?

    Anyway I will continue with the lessons (audio only) but would like to start practicing asap.

    PS - I am an ex programmer

  • Haven't seen any challenges under the tuts for a while so here's one:

    rebuild the clock so it asks the user what the time is then outputs that IN FORMAT :)

  • what was that at 0:06 youtube time

  • @soldado1997 are you 12 yrs of age ?

  • there are some problem bucky

    if it take a modulus of hour than u have to change minute also

    

  • I think when you define your setTime() method, you should plan ahead to include larger numbers. So if they enter 25 hours, have it wrap around to hour 1 rather than defaulting to 0. I did that like this:

    hours = h%24;

    minutes = m%60;

    seconds = s%60;

    You could also wrap the entire thing in an if-statement checking that the values are positive (or write a conditional for each, but one if might be more efficient), negative time doesn't really make sense.

  • the views went down by 20,000. they are noobs

  • @soldado1997 Never back down, we're gonna be great after this playlist! Hang-on with Bucky!

  • @princekhurana14 12 goes into 5 0 times hence the remainder is 5.

    Maybe that is not clear. 5 divided by 12 = 0 with remainder 5.

  • Analog (Not Literally) and Digital

  • "time@190d11" ?

  • I finally got it but missing am and pm dk where I went wrong that I cant get that

  • '{ ' shouldnt be just after function name, it makes the code look worse

    just like in c++,

    function (method) -> next line, bracket

  • Some one please tell me how did we get 5 % 12 as an answer =5 ???

  • i only get 00:00:00

    12:00:00

    00:00:00

    12:00:00

  • @rob2701full you did the printing wrong

    You must for printing am or pm &s not $s

  • when i run this

    return String.format("%d:%02d:%02d $s", ((hour==0||hour==12)?12:hour%1­2), minute, second, (hour < 12? "AM" : "PM"));

    all i get is 00:00:00

    or

    12:00:00 $s can help?

  • My dear Bucky, you may be a fantastic teacher, but your idea of what regular time is is quite wrong.

  • Lol Bucky forgets a parenthesis, I forget a parenthesis :p

  • @karolyipeti Same thing here (Switzerland). I just called the methods "toStandard" and "toAmerican". I just hope the next program won't be about feet and miles...

  • @GeekyMe97

    you are finding the remainder of those variables and then printing them out

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more