Is there an equivalent to php date() style formatting in Java? I mean, in php I can backslash-escape characters to have them treated literally. I.e. yyyy \\y\\e\\a\\
You can use String.format as documented in java.util.Formatter:
Calendar c = ...; String s = String.format("%tY year", c); // -> s == "2010 year" or whatever the year actually is