1

I am using this following way while doing an export to excel

alasql.fn.Date = Date;
alasql('SELECT new Date(mydateString) AS CUSTOM_DATE INTO XLS("' + filename + '.xls",{headers:true}) FROM ?', [items]);

Those above lines are printing in this below date format

 Sat Jun 06 2015 00:00:00 GMT-0500 (Central Daylight Time)

but I want to format mydateString to this below format

MM-DD-YYYY hh:mm:ss 

How can I do that?

yalkris
  • 2,596
  • 5
  • 31
  • 51

1 Answers1

4

I did this below instead and create my own format for date

alasql.fn.datetime = function(dateStr) {
            var date = new Date(dateStr);
            return date.toLocaleString();
        };

alasql('SELECT datetime(mydateString) AS CUSTOM_DATE INTO XLS("' + filename + '.xls",{headers:true}) FROM ?', [items]);
yalkris
  • 2,596
  • 5
  • 31
  • 51