I was wondering if Java Date format can do something like this 2 0 1 3 0 1 3 1, where a space is inserted between each digit. So far I can use this code to make it work.
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
dateString = dateFormat.format(date).replace("", " ").trim();
But I was hoping I can just create a date format to do it all.
Thanks in advance.
Your approach is about as simple as possible.
There is no way to do this within a date format specification (not even with Joda time, as someone else mentioned).
Out of interest, why do you want spaces between the digits like that? It seems unusual?