javascript - Get the time in milliseconds, corresponding to a custom string -


let's have "events" array holds "event" objects, following:

var events = [     {         name: 'event1',         start: '10.30',         end: '10.45'     },{         name: 'event2',         start: '11.00',         end: '12.00'     } ] 

now, have timeout function doing following:

settimeout(function() {     var currenttime = date.now();      // how can transform start , end times events object in milliseconds?      var starteventone = events[0].start // -> how can transform string 10.30 in milliseconds?  }, 1000); 

the question is, how can time in milliseconds, equivalent input string? possible?

hej,

var timearr,      hours,     minutes,     milliseconds,     date;  timearr = events[0].start.split('.'); hours = timearr[0]; minutes timearr[1]; date = new date(0, 0, 0, hours, minutes, 0, 0); milliseconds = date.gettime(); // return number of milliseconds 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -