This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DateFormat class

 
Ankur kothari
Ranch Hand
Posts: 531
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


can anyone explain me what is happening here? what exactly does the format method do?

we have a date and we want to print it in different formats. so what does DateFormat class do? what is Dateformat.getInstance() doing?
 
Dejan Miler
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since Dateformat class is abstract it cannot be instantiated Dateformat.getInstance() returns static instance of Dateformat class.
In another words Dateformat.getInstance() get a default date/time formatter that uses the SHORT style for both the date and the time.
 
S Bhanage
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

can anyone explain me what is happening here?


The code is creating a Date instance with value "Wed Dec 31 21:46:40 EST 1969"
The DateFormat is used to represent this date in various formats.

what exactly does the format method do?


Format returns formated time string in the form you specified while creating
DateFormat instance using "getInstance()" method.

we have a date and we want to print it in different formats. so what does DateFormat class do?


Yes you can do so. Refer to the API to know more details about DateFormat and its use.

what is Dateformat.getInstance() doing?


Get a default date/time formatter that uses the SHORT style for both the date and the time.
 
Ankur kothari
Ranch Hand
Posts: 531
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic