Java

[java] 타입변환 Date 를 String 으로

혜춘 2020. 7. 16. 18:41
728x90
1
2
3
4
5
6
7
8
/**
 * @return yyyy-MM-dd,hh:mm을 String 타입으로 변환
 */
public static String convertTimestampToString(Date timestamp){
    SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm a", java.util.Locale.US);
    String stringDate = transFormat.format(timestamp);
    return stringDate;
}
cs

 

반응형