first of all, let's talk about the application scenario :
Read the data from the XML file, and then return the data inside to the page and draw with a third party plug-in.
The data that is read in XML is, of course, a string type, and if you want to use the drawing plug-in X-axis time mode (which makes it more reasonable to customize such as the x-axis range, the x-axis data format, and so on). You must convert the data to a standard time object. The date type built into JS this time comes in handy:
Copy Code code as follows:
var date = new Date ();
The input field with ID time contains the information extracted in XML
Date.sethours ($ ("#time"). Val (). substring (0, 2) +8);
Date.setminutes ($ ("#time"). Val (). substring (2, 4));
Date.setseconds ($ ("#time"). Val (). substring (4, 6));
The time type in XML is the format of hours in minutes (for example, 083100), which can be used to instantiate the date object using functions such as sethours, Setminutes, setseconds, and so on.