javascript - Format date strings as ISO8601 -


i'm making json call cosm (now xively) return data can plot highchart's highstock chart. see: jsfiddle.net/t7d5u/2/

currently start , end date hard coded this:

 $.getjson('http://api.xively.com/v2/feeds/4038/datastreams/9.json?start=2013-05-01t00:00:00z&end=2013-05-19t23:00:00z&interval=3600?key=dnsisvxztr6qbuqbzll4ccgnnggsakxiqvfsexbnegpqwt0g', function(data) { 

i want start , end dates dynamic. want end date , time now. if may 19, 2013 2:30 pm, formatted this:

end=2013-05-19t14:30:00z

and i'd start time minus 10 days, can rounded day. start time this:

start=2013-05-09t00:00:00z 

btw, i'm not familiar javascript (just c).

also, when try put jsfiddle link in stackoverflow post, error says "links jsfiddle.net must accompanied code." i'm confused this; don't know i'm supposed do.

i way :

// set end current date , time on client var end = new date();  // copy end date , assign start var start = new date(+end);  // set date of start 10 days ago start.setdate(start.getdate() - 10);  alert(start.toisostring()); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -