Spring Framework/Spring
[JAVA] Date 클래스(java.sql) -> Date.valueOf(String)
싹튼
2021. 9. 30. 15:25
[TIP]
년+"-"+월+"-"+일
import org.junit.jupiter.api.Test;
import java.sql.Date;
public class DateTest {
private Date date;
private String birth_year = "1999";
private String birth_month = "01";
private String birth_day = "30";
@Test
public void date(){
this.date = Date.valueOf(this.birth_year + "-" + this.birth_month + "-" + this.birth_day);
System.out.println(this.date);
}
}