M
Meryk
Guest
Hello Shiva, Yes I tried this code : $(document).ready(function(){ // date is in the current RB user time zone, BST in my case var myDate = $("#myDateTimePicker").data("kendoDateTimePicker").value(); console.log('Dater from datePicker is : ' + myDate); // This is returning a string of the UTC date, so in my case it is the RB date - 1 hour (BST = UTC +1) var utcDate = myDate.toUTCString(); console.log('Date converted to UTC is : ' + utcDate); // This formatting is returning the initial date => looks like we are loosing the UTC conversion when we do new Date(utcDate) var formattedDate= rbf_formatDate(new Date(utcDate) , "yyyy-MM-dd HH:mm:ss"); // this the Date format in the DB. console.log('UTC Date formatted before select query is : ' + formattedDate); rbf_selectQuery("select id_ from pufReport WHERE Report_Date But the behavior is not correct. Console prints of the above code are : Selected date is : Thu May 19 2016 12:00:00 GMT+0100 (GMT Daylight Time) Date from datePicker is : Thu May 19 2016 12:00:00 GMT+0100 (GMT Daylight Time) Date converted to UTC is : Thu, 19 May 2016 11:00:00 GMT UTC Date formatted before select query is : 2016-05-19 12:00:00 So at the end, we are querying for the string ' 2016-05-19 12:00:00 ', in the DB., whereas we should be querying for ' 2016-05-19 11:00:00' because the DB dates are in UTC. I think whenever we do new Date() , it just considers the page time zone, is that correct? Any suggestions to get the correct UTC date string ? Thank you Meryem
Continue reading...
Continue reading...