dates in prepared statements

Hello,

I just came across this problem: I am using this code to find some data

var vNow = new Date();
var vQuery = 'SELECT ... WHERE date <= ' + ?;
var vArgs = new Array();
vArgs[0] = vNow;
var vDataset = databaseManager.getDataSetByQuery(..., vArgs, -1);

Servoy uses this

questiondata[1]= 2006-05-31 ,type: java.sql.Date

as the date criteria. The problem is, that here I also need the time portion of the date. How can I manipulate the way the date is passed as argument?

Any help appreciated.

Thanks
Patrick

Shouldn’t the time portion be considered also?

What is your dateprovider type? Really a datetime or timestamp or so?

Otherwise you can always search on a string format like data = ‘yyyy-MM-dd 00:00’ but… That is database dependent so when you can avoid it I would do so!

Ciao

That is database dependent so when you can avoid it I would do so!

That is exactly the reason why I chose to use a prepared statement. The field stores a datetime (I also see the time portion in any form). With the code given above, Servoy ignores the time portion. That’s my problem.

I understand and it is strange… Which Servoy version?

2.2.5

Hmm, I would file it as an issue.

I did.