Compare Javascript Date and DateTimeOffset in the sqlserver

Hi

I store DateTimeOffset in the SqlServer, for example, the field is CreateDate, I want to use AutoQuery to query the data.

But when i send date time from JavaScript, for example: “2015-5-10”, I can not get the data in that day, because AutoQuery can not add timezone to the date.

the datetimeoffset in the sqlserver is like this “2015-05-28 00:00:00.0000000 +08:00”
But AutoQuery datetimeoffset miss +08:00 when it get date from javascript.

I hope i have explain my question clearly. How could i compare date between JS and C#.

It doesn’t support specifying time zones.

OK, I search and modify below snippet, If you have a better idea, plase let me know

String.prototype.CharpStr2Date = function () {
        //[\+\-]:+ is for datetime offset, - is for datetime
        var dateReg = /\/Date\((-?\d+)([\+\-]?\d+)\)\//;
        var date = new Date(parseInt(this.replace(/\/Date\((-?\d+)([\+\-]?\d+)?\)\//, '$1')));
        var createTime = date.format("yyyy-MM-dd");
        return createTime;
    }

    Date.prototype.JSDate2CharpDateTimeOffsetString = function () {
     var date = this;
      return date.getUTCFullYear() + '-' +
                ('00' + (date.getUTCMonth() + 1)).slice(-2) + '-' +
                ('00' + date.getUTCDate()).slice(-2) + ' ' +
                ('00' + date.getUTCHours()).slice(-2) + ':' +
                ('00' + date.getUTCMinutes()).slice(-2) + ':' +
                ('00' + date.getUTCSeconds()).slice(-2)+' +08:00';
    }

In the javascript, timezone of China is -8, but in the sql server, the timezone is +8, i don’t know why, i will research later.