aspose file tools
The moose likes JSP and the fly likes I need a date... No, really! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply 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: 4115
    
    2

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] [MiH]
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: 14456
    
    7

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.
 
I agree. Here's the link: jrebel
 
subject: I need a date... No, really!
 
Similar Threads
PGP (Pretty Good Privacy)
Unable to get Date instance in a particular format
choices.txt structure.
Regarding HttpSession
first date and last date of month