Author
How o Display dateformat
anilellendula kumar
Ranch Hand
Joined: Jul 12, 2005
Posts: 43
Hai! want date format like 22July2005-hh mm ss, can u help me on this
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8262
Have a look at java.text.DateFormat and java.text.SimpleDateFormat
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch ]
anilellendula kumar
Ranch Hand
Joined: Jul 12, 2005
Posts: 43
hai! Date date = new Date(); s3 = DateFormat.getDateInstance().format(date); i tried this it is giving July 22, 2005 5:48:56 pm i want 22 july 2005 "-" hh mm ss which methods of DateFormat give this o/p
James Sabre
Ranch Hand
Joined: Sep 07, 2004
Posts: 781
posted Jul 22, 2005 11:58:00
0
As Joe says, SimpleDateFormat does what you want. You will need to look very carefully at the Javadoc to make sure you setup the pattern you want.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
nan sud
Greenhorn
Joined: Feb 27, 2004
Posts: 8
example: java.util.Date date = new java.util.Date (); java.text.SimpleDateFormat data = new java.text.SimpleDateFormat ("EEE, MMM d,'-' HH:mm:ss z"); System. out.println(data.format(date).toString()); [ July 22, 2005: Message edited by: nan sud ]
yash Vi
Ranch Hand
Joined: Jul 17, 2005
Posts: 41
check these two links, http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-dates.html http://www.javaworld.com/javaworld/javaqa/2001-10/01-qa-1005-dateformat.html It will help you do wot you want
Thanks for your reply and time.<br />Windows 2000,j2sdk1.4.2_08
subject: How o Display dateformat