It's been a while since I've done this and I don't have the code anymore. Anyone have the code to do this, or have a better suggestion for generating a unique ID?
If you just want a unique-ish number, then
var timestamp = new Date().getUTCMilliseconds();
would get you a simple number. But if you need the readable version, you're in for a bit of processing:
var now = new Date(); timestamp = now.getFullYear().toString(); // 2011 timestamp += (now.getFullMonth < 9 ? '0' : '') + now.getFullMonth().toString(); // JS months are 0-based, so +1 and pad with 0's timestamp += (now.getDate < 10) ? '0' : '') + now.getDate().toString(); // pad with a 0 ... etc... with .getHours(), getMinutes(), getSeconds(), getMilliseconds()