Results 1 to 3 of 3
  1. #1
    Felissa is offline Member
    Join Date
    Jun 2007
    Posts
    95
    Rep Power
    0

    Default Problem with calendar

    I am trying to create the following program, however, I have never been exposed to the calendar class. I looked at the APIs but it still doesn't make sense. Can anyone help me out?

    Objective:
    • Set a Locale object to France
    • Create a Calendar instance for October 12th, 2007
    • Create a Date Format instance that displays the date in the proper format

    Thanks.
    Felissa:p

  2. #2
    Marcus is offline Member
    Join Date
    Jun 2007
    Posts
    92
    Rep Power
    0

    Default

    What do you have so far? The Locale class has a simple constructor:
    Java Code:
    Locale locale = new Locale( Locale.FRANCE );
    Then you can get and set a Calendar class with something like:
    Java Code:
     Calendar calendar = Calendar.getInstance();
     calendar.clear();
     calendar.set( 2007, 9, 12 ); // the month is zero based
    And lastly, you can use the DateFormat.getDateInstance to help you format the date.

    Greetings

    Marcus:cool:

  3. #3
    Felissa is offline Member
    Join Date
    Jun 2007
    Posts
    95
    Rep Power
    0

    Default

    This what I have so far:

    Java Code:
    import java.util.*;
    import java.text.*;
    
    public class Calendar {
    public static void main(String[] args) {
    
    Date current = new Date ();
    DateFormat DF = DateFormat.getDateInstance();
    
    String str = DF.format(current);
    
    System.out.println("Date: " + str);
    }
    }
    I'm not sure how to add the locale or how to hard code the date.
    Thanks
    Felissa:p

    Thanks for your time!!

Similar Threads

  1. calendar
    By John in forum SWT / JFace
    Replies: 12
    Last Post: 08-07-2008, 11:54 PM
  2. How to Show Calendar
    By praveen.kb in forum AWT / Swing
    Replies: 2
    Last Post: 02-09-2008, 09:23 AM
  3. Calendar.DATE
    By mew in forum New To Java
    Replies: 1
    Last Post: 01-04-2008, 08:51 PM
  4. Web calendar
    By Daniel in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 06-27-2007, 06:36 PM
  5. k5n Desktop Calendar 0.9.0
    By levent in forum Java Software
    Replies: 0
    Last Post: 06-02-2007, 08:13 AM

Posting Permissions

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