Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

date

 
Jackie Wang
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how i can get a string
very simple string for the current date?
I just want "31/12/2002"
that's it.
thanks!
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jackie,
Any of the following will get you the current date:
new java.util.Date()
new java.util.GregorianCalendar()
java.util.Calendar.getInstance()
To convert the date to a formatted string, use:
java.text.SimpleDateFormat
For me, the class documentation ("javadoc") was sufficient for me to understand how to use the above-mentioned classes.
Hope this has helped you.
Good Luck,
Avi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic