• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help required in Dates/ SimpleDateFormat  RSS feed

 
Sridhar Ranganthan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please find my program here


output :- Today = 20/012/2005
According to the input it should display 20/dec/2005.
If i pass input 25/1/2005 and new SimpleDateFormat("mm/dd/yyyy") output should be 01/25/2005.
Based on the format patterns it should format the date value. Please help me the same.

Thanks,
Sridhar.R

 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really want the month in the format 012? I have never seen a month written like that. 1, 01 and 12, yes, but never 012.
 
Sridhar Ranganthan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, When i execute this program i got the output like that,

Please help me the same based on the patterns date value it should change. Date value will come through the run time/DB.

Thanka,
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Lower case "m" stand for minutes -- not months. The special logic that replaces "DEC" for 12, if there is enough room, don't apply here.

Henry
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lowercase m means minutes. For months use uppercase M.

Edit: wow, Henry pulled a Rob on me
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!