Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

making a new string from old string

user575089Dec 13 2016 — edited Jan 17 2017

I have two String .

String str1="01/12/2016" 

I want to convert into another String str2="20161201"

One way I can think of is to split the string and then append from backwards to generate this new string.  Is there any easy  way one can make it ?

and ...

String str3="13/12/2016" 

I want to convert into another string str4="20161214"

I can think of it as split and then add like this ...

"2016"+"12"+  "convert to integer (13) + 1"

Is there any easy  way one can make it ?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 14 2017
Added on Dec 13 2016
6 comments
304 views