aspose file tools*
The moose likes Beginning Java and the fly likes How can I change my Date format? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How can I change my Date format? " Watch "How can I change my Date format? " New topic
Author

How can I change my Date format?

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Dear Friends,
My Date format is like:
Wed Dec 19 16:26:37 PST 2001
Because I defined it like:
import java.util.Date;
...
Date today=new Date();
strSubmittedDate = today.toString();
How can I get the shorter text like "Wed Dec 19"
what should I add to the code?
Please help...
Thanks,
Elahe


Thanks,
Elahe
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Check out the API docs for java.text.SimpleDateFormat
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Thanks Jim for quick reply but I couldn't find any example for MEDIUM foramt to get idea how I can implement it?!!
any advice?
Elahe
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Ok this produces a date is the format of your above example.

Btw, my name is James not Jim
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
It works...
Thanks James
aminur rashid
Ranch Hand

Joined: Sep 21, 2001
Posts: 79
What is in name James .Haven't u heared A rose is a rose even when u call it by some other name
N'joy


Regards<br />Aminur
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
That was the good one...
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
What is in name James .Haven't u heared A rose is a rose even when u call it by some other name
N'joy
--------------------
Regards
Aminur

Bob, I am flattered by your kind words and impressed by your wisdom.
Thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I change my Date format?