java string to date , date to string
๐จ๐ป๊ฐ๋ฐ/โJava
2020. 8. 12. 17:57
import java.text.SimpleDateFormat; import java.util.Date; //String to Date String str="2020-08-12 17:52:08"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date strToDate=sdf.parse(str);//return : Wed Aug 12 17:52:08 KST 2020 //Date to String SimpleDateFormat f1 = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat f2 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat f3 ..
java string to int , int to string
๐จ๐ป๊ฐ๋ฐ/โJava
2020. 8. 12. 17:45
//String to Int String str = "12345"; int num = Integer.parseInt(str); //Int to String int num2 = 123; String str2 = Integer.toString(num2);