MySQL like date formatting in JavaScript