Java SimpleDateFormat format Date to String as "200225110827-0800"
import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] args) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyMMddHHmmssZ"); String dateAsString = simpleDateFormat.format(new Date()); System.out.println(dateAsString); }//from w w w .j a v a2 s.c o m }