Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can i get month in words( eg:January) using Date,Calendar or GregorianCalendar API  RSS feed

 
Rinku Sharma
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I am facing problems in getting the Day, Month in words example(Monday or January).Is there a possibility to get day and month in words by craeting a date, calendar objects.
eg:
Calendar c=Calendar.getInstance();
c.set(2001,4,2)
now what should i write to get the month or day in words.
Amit
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the DateFormat class in java.text package. You will need to specify the date format as FULL. check out the API...
Bosun
 
Raja Shekhar
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rinks..
You know The Month in number... and
The Day in number....rite..
Then Just use case Stateemnt to get the
Day/Month in Characters..
chio..
Raj
 
Phil Hanna
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.text.*;
...
String monthName = new SimpleDateFormat("MMMMMMMMM").format(date);
String dayName = new SimpleDateFormat("EEEEEEEEE").format(date);

------------------
Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!