Cobalt.Date.Format = function (date, pattern) { var formatted; switch(pattern) { case "dd/mm/yyyy": formatted = (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear(); break; // Other people put cases here default: break; }; return formatted;};