Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Need help for making a world-clock.

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help for making a world-clock.

    Hi all!
    I have an assignment in my OOP class to make a World Clock containing some special cities etc.
    My real question though is how can I implement a standard time (GMT maybe) that actually updates or refresh when ever I start up the program?
    If this is possible to implement my idea then was to create the different cities according to GMT and then just add whatever Timezone and DST the following city has.

    Kind Regards


  2. #2
    Member
    Join Date
    Oct 2011
    Posts
    42
    My Mood
    Sneaky
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default Re: Need help for making a world-clock.

    a new Date object initializes to the current UTC date/time.

    You can use the Simple Date format to set a time zone, which you get from TimeZone. Then use it to build your formatted date.


    SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
    dateFormatGMT.setTimeZone(TimeZone.getTimeZone("GMT"));

Similar Threads

  1. Help with Clock (advance and reverse day,hour,minute)
    By whyld4900 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 13th, 2011, 02:39 AM
  2. Analogue Clock Problem
    By gargamel7 in forum What's Wrong With My Code?
    Replies: 48
    Last Post: September 2nd, 2011, 01:21 PM
  3. Making a clock
    By javapenguin in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 7th, 2011, 04:36 PM
  4. Need help in developing a clock application
    By sb.shiv in forum AWT / Java Swing
    Replies: 2
    Last Post: August 24th, 2010, 02:00 AM
  5. help with clock class
    By collinsislee in forum Object Oriented Programming
    Replies: 1
    Last Post: February 24th, 2010, 02:53 PM

Tags for this Thread