Tuesday, August 11, 2009

24 Hours of Nonstop SQL Server Training

Get ready for brain overload, 24 hours of nonstop SQL Server training by experts all around the world! And best of all it is FREE and you don't have to go anywhere to get this training. Here is the link to this training http://24hours.sqlpass.org.

Anyway the reason for my post is not to propagate about this event, though it is not a bad idea, but to share a little javascript. When I went to register for sessions, all the start times are listed in GMT and I wanted to be able to see the times in local timezone format. Here is a sample screenshot of how the start times are listed:



If you are using IE8, it is really easy to run custom javascript code on any page, you simply press F12 and go to the Script tab in the Developer Tools window and then run the following javascript code:


var sp = document.getElementById("schMeetings");
var timeSpans = sp.getElementsByTagName("span");
for (var i = 0; i < timeSpans.length; ++i)
{
if (timeSpans[i].id.indexOf("lblScheduletime") > 0)
{
var dtStr = timeSpans[i].innerText;
var dt = new Date(dtStr.substr(0, dtStr.length-"+00:00".length));
timeSpans[i].innerHTML += " [" + dt.toLocaleString() + "]";
}
}


Once I ran this javascript snippet, I can see the start times in my local timezone format as shown below:



I really like the new IE8 Developer Tools and this is just a sample of what you can do with custom javascript on any web page you visit.

Happy Coding,

Sonny