| Author |
Help required in Dates/ SimpleDateFormat
|
Sridhar Ranganthan
Ranch Hand
Joined: Mar 12, 2009
Posts: 31
|
|
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
Sheriff
Joined: Oct 13, 2005
Posts: 32712
|
|
|
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
Joined: Mar 12, 2009
Posts: 31
|
|
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
Joined: Sep 28, 2004
Posts: 16695
|
|
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
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Lowercase m means minutes. For months use uppercase M.
Edit: wow, Henry pulled a Rob on me
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Help required in Dates/ SimpleDateFormat
|
|
|