0

by using:

Date.parse('2015-01-01');

it gives output: Thu Jan 01 2015 05:00:00 GMT+0500 (Pakistan Standard Time)

but i want just like this: Thu Jan 01 2015

(moreover i am using it in morris.js chart)

Umer bin Siddique
  • 450
  • 1
  • 4
  • 12

1 Answers1

0

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Conversion_getter

new Date('2015-01-01').toDateString();
CyberFox
  • 708
  • 5
  • 22
  • I want to fix it here but its not working can you please update this js code http://jsbin.com/nunusopaca/1/ – Umer bin Siddique Jan 23 '15 at 05:29
  • I looked at it briefly and i can see the problem occurs not with your code but a leaky abstraction that is you graphing plugin. I'm not gonna spend too much time on that sorry :( I would like to mention that the Date.parse(string) method that you've chosen to use generate a UNIX time which is a NUMBER a very big number counting the amount of milliseconds from 1970. The graphing system you use converts this number into a readable date by it's own conventions. But it's really up to the plugin to decouple that convention. Lastly you should look at FLOT if this is no go. http://www.flotcharts.org/ – CyberFox Jan 25 '15 at 18:35