I'm working with Javascript dates, and I'm getting a bit confused with trying to take a date from a string.This is the code I have:\[code\]var formatDate = function(dateObj) { // make sure date values are two digits and months start at 1 var adjMonth = dateObj.getMonth() + 1; var adjDate = dateObj.getDate(); if (adjMonth < 10) adjMonth = '0' + adjMonth; if (adjDate < 10) adjDate = '0' + adjDate; // build and return dateStr var dateStr = dateObj.getFullYear() + '-' + adjMonth + '-' + adjDate; return dateStr;};$(document).ready(function() { var testIn1 = "2012-02-01"; var testDate1 = new Date(testIn1); var testDate1Str = formatDate(testDate1); var testIn2 = "2012-01-31"; var testDate2 = new Date(testIn2); var testDate2Str = formatDate(testDate2); $('#output').html("---Input = '" + testIn1 + "':<br>" + testDate1 + "<br>" + testDate1Str + "<br>" +"---Input = '" + testIn2 + "':<br>" + testDate2 + "<br>" + testDate2Str + "<br>");});?\[/code\]Results I get from this are:\[code\]---Input = '2012-02-01':Tue Jan 31 2012 18:00:00 GMT-0600 (CST)2012-01-31---Input = '2012-01-31':Mon Jan 30 2012 18:00:00 GMT-0600 (CST)2012-01-30\[/code\]Which makes no sense to me, why are the days one off? Doesn't seem sensical to get 2012-01-31 from 2012-02-01... What am I missing here?