Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-2007, 09:25 PM
Member
 
Join Date: Jun 2007
Posts: 95
Felissa is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-01-2007, 09:34 PM
Member
 
Join Date: Jun 2007
Posts: 92
Marcus is on a distinguished road
What do you have so far? The Locale class has a simple constructor:
Code:
Locale locale = new Locale( Locale.FRANCE );
Then you can get and set a Calendar class with something like:
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
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-01-2007, 09:39 PM
Member
 
Join Date: Jun 2007
Posts: 95
Felissa is on a distinguished road
This what I have so far:

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

Thanks for your time!!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
calendar John SWT / JFace 12 08-07-2008 11:54 PM
How to Show Calendar praveen.kb AWT / Swing 2 02-09-2008 09:23 AM
Calendar.DATE mew New To Java 1 01-04-2008 08:51 PM
Web calendar Daniel Enterprise JavaBeans 1 06-27-2007 06:36 PM
k5n Desktop Calendar 0.9.0 levent Java Announcements 0 06-02-2007 08:13 AM


All times are GMT +3. The time now is 10:05 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org