Рубрика: What???

It problem or undestund why it is working that.

SetHours for Date in sap ui5, how do if date reduce -1 day, or you filter not working

Blog, Odata, What???

So,

First situation when in the backend server you saw rhat date less on -1 day!
What happend? It odata sevices do crayzy date!
What you can do?

just try use that:
var conv = function(conv_date){
var dateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern : "yyyy-MM-ddTKK:mm:ss" });
var lv_date_val = new Date(conv_date);
var dateStr = dateFormat.format(lv_date_val);
return dateStr;
}

in you data request use
odata.validdate = conv(odata.validdate);

second situation, when you use filter,
and you neded use setHours on the date.
How you can understund how match hours set?

Try use that
var sHours = new Date().getHours() - new Date().getUTCHours();

and
var value = new Date();
value.setHours(sHours);