Javascript function for easy date formatting. Based on the php date function.