Convert a MySQL Date String into Javascript Date Object

Here is a Javascript function that I threw together the other day that will take the default format of a MySQL DATETIME or TIMESTAMP field (YYYY-MM-DD HH:MM:SS) and convert it into a Date object in Javascript.

function parse_date(string) {
    var date = new Date();
    var parts = String(string).split(/[- :]/);

    date.setFullYear(parts[0]);
    date.setMonth(parts[1] - 1);
    date.setDate(parts[2]);
    date.setHours(parts[3]);
    date.setMinutes(parts[4]);
    date.setSeconds(parts[5]);
    date.setMilliseconds(0);

    return date;
}

Force a Browser to Enable Spell Checking on an Input or Textarea

Now that many modern browsers include the ability to check spelling on forms, it is nice to be able to turn on spell checking for certain fields when coding the form. This is a pretty basic html attribute, but it seems surprising undocumented on the web.

Here is an example of forcing a input field to automatically enable spell checking.

Alternatively you could turn off spell checking with the following code.

I don't think that this attribute is actually a part of any html/xhtml standard (yet), however it seems to work in most modern browsers that support spell checking.

Updates for 2009-01-27

Updates for 2009-01-15

Updates for 2009-01-14

Updates for 2009-01-13

Updates for 2009-01-11

Updates for 2009-01-09

Updates for 2009-01-08

Updates for 2009-01-07

...older
{
}