• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How o Display dateformat

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai!

want date format like 22July2005-hh mm ss, can u help me on this
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at java.text.DateFormat and java.text.SimpleDateFormat
 
anilellendula kumar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic