반응형

#java #오늘 #일자 #string #format #YYYYMMDD

오늘 날짜를 문자 YYYYMMDD  포맷으로 나오게 하는 방법

import java.util.Calendar;

import java.text.SimpleDateFormat;



public class testToday{

    public static void main(String args[]){

        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");

        Calendar c1 = Calendar.getInstance();

	 String strToday = sdf.format(c1.getTime());



        System.out.println("Today=" + strToday);

    }

}
반응형

+ Recent posts