Javascript logo

In SharePoint queries you should use date in the format 'yyyy-mm-ddTHH:MM:SSZ', for example, 2019-09-30T09:00:00Z. But the input form of the SharePoint datetime controls returns the value as 'dd.mm.yyyyy', the time value you will recieve in another way.

Here is good snippet to convert string in the format 'dd.mm.yyyy' to use in SharePoint queries:

var datestart = '25.09.2019 16:45';
var tdatestart = datestart.replace(/(\d{2})\.(\d{2}).(\d{4}) (\d{2}):(\d{2})/,  '$3-$2-$1T$4:$5') + ':00Z';
console.log('tdatestart', tdatestart);
// tdatestart 2019-09-25T16:45:00Z