Convering yyyy-mm-dd to unix timestamp in array and put it back at the same position after converted it.

I'm very new at javascript and highstock. I want to put datetime into Highstock and realized that it accepted just only Unix time stamp. However, my datetime data is in yyyy-mm-dd format how can I convert datetime data in object and put it back to the same position?

My data is

object =

a: [ '2014-04-12'(string), 120],

b: [ '2013-02-12', 300],

c: [ '2013-03-15', 300]

But, there are 1000 data in my object I would be grateful if you could help me with this issue.

Thank you!

Answers


If your object actually looks like this:

object = {
 a: [ '2014-04-12', 120],
 b: [ '2013-02-12', 300],
 c: [ '2013-03-15', 300]
}

you can do this:

for(var k in object) {
   object[k][0] = new Date(object[k][0]).getTime()
}

http://jsfiddle.net/c5hpe0qq/1/


Need Your Help

XSL Looping: how to loop where node name increments

xslt loops while-loop

How would one loop thru a set of nodes, where the node name has a numeric number and the number increments as in a series?

How to use OpenGL without displaying it?

android opengl-es background-process

For an application i want to render things in background even when the app is not currently displayed. The official docs write to open a GLcontext via a GLSurfaceView. For not displaying graphics and

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.