Thanks for the solution Johan. The toString method for formatting dates is part of the Date.js open source code.