This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I am using the date formatter class to format the currentdate in the format "yyyymmdd". But in the output is in other format i.e "20013927" . Can anyone identify where I was doing wrong? Any help is appreciated. Thanks in advance. The code follows /* use the pattern and currentlocale to custom format the date & time */ import java.util.*; String DateTimeStr = ""; java.util.Date CurDate; SimpleDateFormat formatter; public GenerateSalesInvXML() { super(); formatter = new SimpleDateFormat("yyyymmdd"); CurDate = new java.util.Date(); DateTimeStr = formatter.format(CurDate); }
Michael Bruesch
Ranch Hand
Joined: Sep 23, 2001
Posts: 158
posted
0
You're using the lower case m, which is for the minutes in the hour. Instead, use capital M, for month of the year. Something like: SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMdd"); Hope this helps
Michael J Bruesch<br /><i>I code, therefore I am.</i>
padma wundavalli
Greenhorn
Joined: Feb 22, 2001
Posts: 15
posted
0
Thank you. Too much experience in the language like VB still has influence on overlooking the case sensitives. Thanks again. Padma