Hi,
My dates in the grid are being displayed one day behind even though I have set the EnableUtcDates(true).
I have enabled UTCDates in my grid model through the MVC GridModel() method like this :
GridModel GetGridModel(selectedRow) {
GridModel gridModel = new GridModel(); gridModel.ID = "MyGrid"; gridModel.AutoGenerateColumns = false; gridModel.PrimaryKey = selectedRow.PrimaryKey; gridModel.Width = "100%"; gridModel.Height = "400px"; gridModel.EnableUTCDates = true;
.... ....// other settings
..... ......
return gridModel;
}
1) The date I get from server is 7/1/2012 00:00:00.000 & the grid displays 6/30/2012 (Here the month & day both are decremented because of 1st date)
2) The date I get from server is 11/11/2014 00:00:00.000 & the grid displays 11/10/2014 (Here only the day is decremented)
---------------
This issue is also discussed here but the answer suggests to enable UTCDates feature of the grid.
http://es.infragistics.com/community/forums/t/80982.aspx
I have enabled UtcDates, I am still facing the issue. What am I doing wrong?
Thanks.
Hello,
I'm just following up to see if you need any further assistance with this issue. If so please let me know.
I will be awaiting your feedback.
Thanks I will implement it in 3-4 days and let you know how it goes. Thanks for the help.
Hello Zep,
You can use a formatter function to workaround this.
Please review the attached sample.
Hello Denis,
I think it has something to do with the timezone but I am not sure how to set the correct time zone.
This stackoverflow post is exactly what I am experiencing & the answers there suggest of using the correct time zone. This is the link , please have a look here. How can I set the correct time zone. My local time zone is Gmt +5.
http://stackoverflow.com/questions/7556591/javascript-date-object-always-one-day-off
The first answer on StackOverflow is this :
Notice that Eastern Daylight Time is -4 hours and that the hours on the date you're getting back are 20.
-4 hours
20
20h + 4h = 24h
which is midnight of 2011-09-24.
You're getting the right date, you just never specified the correct time zone.
If you need to access the date values, you can use getUTCDate() or any of the other getUTC*() functions:
getUTCDate()
getUTC*()
var d, days; d = new Date('2011-09-24'); days = ['Sun', 'Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat']; console.log(days[d.getUTCDay()]);Do I have to pass all of my dates through this routine & add +4 hours to them or is there another way. Thanks.
var d, days; d = new Date('2011-09-24'); days = ['Sun', 'Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat']; console.log(days[d.getUTCDay()]);