Api call to save date column always save column type as double

I want to save date in data object just via api , is it possible ? In following code prodDate column
saved in double instead of DateTime. I think I will not be able to use date query operators to query through this date
column. changing a column data type in console solves a problem but I want to know how to do from code

function Product(args) {
args = args || {};
this.Plant = args.Plant || "";
this.prodDate = args.prodDate || "";
}
var dataStore = Backendless.Persistence.of(Product);
var commentObject = new Product({Plant: "PTA", prodDate: new Date("03/25/2015")});
dataStore.save( commentObject );

Hi Mousa,

Is it possible for you to create the schema at first (and columns with required times) and then do the requests? It would solve your problem completely.

I prefer to create the schema and table together by api call rather than console is it possible to do?
I couldn’t find any code or clear explanation regarding saving date through Api

I’ve created an internal task to investigate this issue. We’ll report back as soon as we have any results.

Thanks!

Thanks Sergey

I’ll wait for your report
Regards
Mousa

I do not think you can force the backend to create a DATE column from an API call. Date is serialized as a number and the backend does not know if you intended to have it as a number or date.

So, should I change a saved double column to Date in console after Table being saved in backend ? or double number column can be used as date ?

If you use REST API or the JS SDK, then keeping it as Number on the server side is okay. However for iOS/Android clients, it would need to change to DATETIME.

Thanks Mark
I will create the tables by JS SDK and query by android SDK so I will change the columns to DateTime

Best Regard
Mousa