Read through the source code for the format() function in momentJS.
Added commented JS code to the format() function with everything it needs.
Going to be interesting how this quite highly functional bit of code will translate into Java.
Hopefully not too many classes and OO boilerplate.