My line chart shows wrong date format for the X-axis label. It is showing /Date(1425148200000)/
, but I want it to show as dd/MM/yyyy
.
This is my code:
.CategoryAxis(axis => axis.Categories(model => model.Price.EffectiveDate))
My line chart shows wrong date format for the X-axis label. It is showing /Date(1425148200000)/
, but I want it to show as dd/MM/yyyy
.
This is my code:
.CategoryAxis(axis => axis.Categories(model => model.Price.EffectiveDate))
I handled this in the client side (javascript).
In client code, you need to instance a Date object passing this value 1425148200000 to the constructor, like:
var x = new Date(1425148200000)
here's what x will look like afterwards:
Sat Feb 28 2015 20:30:00 GMT+0200 (Jerusalem Standard Time)
Then you just need to format it as you wish. (you can use the following date object methods to return a string in a DD/MM/YYYY format:
x.getDate() // returns 28
x.getMonth() // returns 1
x.getFullYear() // returns 2015
Alternatively, you may opt to display a string field in the grid, instead of the date value itself, which value would be the return of "toShortDateString()" on your DateTime object.