This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes convert custom date format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "convert custom date format " Watch "convert custom date format " New topic

convert custom date format

Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223

i have a input like

13/12/2008 (dd/mm/yyyy) or 13-12-2008,

I want to change the format to 12/13/2008 (mm/dd/yyyy) or 12-13-2008.

Is it possible? Is there any function available?

Please advise.

Thank You<br />Edward
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15001

You could parse the string with the input format, then format the resulting Date object with the output format. For example:

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: convert custom date format
It's not a secret anymore!