private String getDateSuffix ( ) { Calendar cal = Calendar . getInstance ( ) ; int year = cal . get ( Calendar . YEAR ) ; int month = cal . get ( Calendar . MONTH ) ; // 0 to 11 int day = cal . get ( Calendar . DAY_OF_MONTH ) ; int hour = cal . get ( Calendar . HOUR_OF_DAY ) ; int minute = cal . get ( Calendar . MINUTE ) ; int second = cal . get ( Calendar . SECOND ) ; return String . format ( "-%4d-%02d-%02d_%02dh%02dm%02ds" , year , ( month + 1 ) , day , hour , minute , second ) ; }
Returns a date suffix string