날짜를 문자열 포맷으로 변경하는 방법

package test;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateToStr {
	public static void main(String[] args) {
		Date from = new Date();

		SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String current = transFormat.format(from);
		
		System.out.println(current);
	}
}


Ref.

http://nota.tistory.com/50