java date in mmddhhmmss format
date, date-format, datetime, java, simpledateformat
Solution
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat("MMddhhmmss");
String dateAsString = simpleDateFormat.format(new Date());
System.out.println(dateAsString);
Output:
0307114712
Problem
I want to add date to the file so i maintain archive. I want date in this format: mmddhhmmss So the file name is "cGroup0307131614", just that i want to add timestamp. Not necessary it should be mmddhhmmss format but a format that maintains timestamp. I tried the foll: ``` java.util.Date date= new java.util.Date(); System.out.println(new Timestamp(date.getTime())); ``` But o/p is 2013-03-07 14:59:30.252. I dont want any spaces colons or special characters.