William Bradee
Posts: 0
Joined: Thu Oct 03, 2013 8:45 pm

DB native _createdAt and Columns of type date Different?

Have a column "RecordedAt" of type date.

Query for column _created at requires:

{"_createdAt":{"$date":"2013-11-13T13:54:05.784Z"}}

but query for RecordedAt (my column) requires:

{"RecordedAt":"2013-11-13 14:00:00.000"}

If I use:

{"RecordedAt":{"$date":"2013-11-13T14:00:00.000Z"}}

I get:
{
"status":"400 Bad Request",
"url":"https://api.appery.io/rest/1/db/colle...",
"response":{
"code":"DBSQ252",
"description":"Invalid value for type 'date': 'Wed Nov 13 06:00:00 PST 2013'."
}
}

I just figured this out through trial-and-error. Is this a bug or a fundamental difference in Date columns versus "createdAt" and (I assume) "updatedAt" columns?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

DB native _createdAt and Columns of type date Different?

Hi William,

You should use the following query:pre{"RecordedAt":"2013-11-13T14:00:00.000Z"}/preHere is the description of date format in Appery.io: http://docs.appery.io/documentation/b...

jaydatt
Posts: 0
Joined: Tue Feb 11, 2014 7:23 pm

DB native _createdAt and Columns of type date Different?

Hello,

I am trying to do a query on _createdAt field something like following

{"_createdAt":"2014-02-23 00:00:00.000"}

However I am not getting any records even though we have records with the same createdAt in the table. Could you please tell me what's wrong here?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

DB native _createdAt and Columns of type date Different?

Hi,

You shouldn't use string date value. You can use this code:pretoday = new Date();
yesterday.setDate(today.getDate() - 1);
temp = new Date(yesterday.getFullYear() + "-" + yesterday.getMonth() + "-" + yesterday.getDay());
yesterdayStr = temp.toISOString();
s = jQuery.parseJSON('{"_createdAt":{"$lt":"' + yesterdayStr + '"}}');

return s;/preReturn records created before yesterday.

Return to “Issues”