wood burning stoves 2.0*
The moose likes JSP and the fly likes I need a date... No, really! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "I need a date... No, really!" Watch "I need a date... No, really!" New topic
Author

I need a date... No, really!

George Larry
Ranch Hand

Joined: Nov 07, 2001
Posts: 52
How can I get todays date as a string in the form mm/dd/yy?
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4458
    
    6

try SimpleDateFormat("MM/dd/yy") or if you are using JSPs, you might try using the Jakarta DateTime Taglibs
Junilu


Junilu - [How to Ask Questions] [How to Answer Questions]
George Larry
Ranch Hand

Joined: Nov 07, 2001
Posts: 52
Yes, but how do I get TODAY's date?... that's the first part, then I need to convert it to a string in the mm/dd/yy format.
Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

java.util.Date now = new java.util.Date();
Initializes "now" to the current time and date. Then you can use the dateformatting code listed above to get it as a String.
This isn't JSP-related, BTW -- it's basic Java.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: I need a date... No, really!