I want to do a sql statement which queries by timestamp using javascript.
Here is how i set my timestamp:
var startTime = new Date(year, month, day, 0, 0);
var endTime = new Date(year, month, day, 23, 59);
My sql statement is:
'SELECT * FROM proximate.user WHERE join_timestamp >= $1 ' +
'AND join_timestamp<=$2 ORDER BY user_id ASC';
$1 is startTime and $2 is endTime. Given if the startTime is Sat Dec 01 2012 00:00:00 GMT+0800 (SGT)
and endTime is Sat Dec 01 2012 23:59:00 GMT+0800 (SGT)
, the executed statement returns results which include timestamp that is a day before the startTime.
Anyone has any idea why?
Thanks in advance.