• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Date Question

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

How can i get the System Date(current Date ) in yyyy-mm-dd format?

Help me pls.

Thanks in Advance

Vineela
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, i guess you posted you are in the wrong forum but try
to study the code below which might help you.



import java.util.*;
import java.text.*;

class DisplayDate{

public static void main(String[] args) {
System.out.println(new SimpleDateFormat("yyyy-mm-dd").format(new Date()));
}

}
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anothet thing whenever you start thinking up about formatting dates then u also end up trying to externalize all ur messages into resource bundles so also look up the internationalization tutorial from sun.
http://java.sun.com/docs/books/tutorial/i18n/index.html

You should start using this especially the MessageFormat class
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic