Solution – (tl;dr version)
datetext = d.toTimeString().split(' ')[0]
Explanation:
toTimeString returns the complete time.
We split it by space to get the time component only, then take the first value which is of use. 🙂
Complete Flow:
d = new Date();
// d is "Sun Oct 13 2013 20:32:01 GMT+0530 (India Standard Time)"
datetext = d.toTimeString();
// datestring is "20:32:01 GMT+0530 (India Standard Time)"
// Split with ' ' and we get: ["20:32:01", "GMT+0530", "(India", "Standard", "Time)"]
// Take the first value from array :)
datetext = datetext.split(' ')[0];
Note: This does not require you to include any external files or libraries hence time required for execution would be faster.