This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "date" Watch "date" New topic
Author

date

Jackie Wang
Ranch Hand

Joined: Apr 18, 2002
Posts: 315
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

Joined: Oct 11, 2000
Posts: 1121

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.
 
jQuery in Action, 2nd edition
 
subject: date
 
Similar Threads
first date and last date of month
Date difference
Update more than one rows through one Submit/Update Button
String conversion
compare dates which are in string variable in javascript