lib/time.js
function (dt, format) {
            var ret = "";
            if (isInstanceOf(dt, SQL.Time)) {
                ret = this.timeToString(dt, format);
            } else if (isInstanceOf(dt, SQL.Year)) {
                ret = this.yearToString(dt, format);
            } else if (isInstanceOf(dt, SQL.DateTime)) {
                ret = this.dateTimeToString(dt, format);
            } else if (isInstanceOf(dt, SQL.TimeStamp)) {
                ret = this.timeStampToString(dt, format);
            } else if (isDate(dt)) {
                ret = dateFormat(dt, format || this.dateFormat);
            }
            return ret;
        }
function (dt, format) {
            var ret = "";
            if (isInstanceOf(dt, SQL.Time)) {
                ret = this.timeToString(dt, format);
            } else if (isInstanceOf(dt, SQL.Year)) {
                ret = this.yearToString(dt, format);
            } else if (isInstanceOf(dt, SQL.DateTime)) {
                ret = this.dateTimeToString(dt, format);
            } else if (isInstanceOf(dt, SQL.TimeStamp)) {
                ret = this.timeStampToString(dt, format);
            } else if (isDate(dt)) {
                ret = dateFormat(dt, format || this.dateFormat);
            }
            return ret;
        }
function ( dt , format ) { var ret = "" ; if ( isInstanceOf ( dt , SQL . Time ) ) { ret = this . timeToString ( dt , format ) ; } else if ( isInstanceOf ( dt , SQL . Year ) ) { ret = this . yearToString ( dt , format ) ; } else if ( isInstanceOf ( dt , SQL . DateTime ) ) { ret = this . dateTimeToString ( dt , format ) ; } else if ( isInstanceOf ( dt , SQL . TimeStamp ) ) { ret = this . timeStampToString ( dt , format ) ; } else if ( isDate ( dt ) ) { ret = dateFormat ( dt , format || this . dateFormat ) ; } return ret ; }
Converts a date to a string.

@example

var date = new Date(2004, 1, 1),
timeStamp = new sql.TimeStamp(2004, 1, 1, 12, 12, 12),
dateTime = new sql.DateTime(2004, 1, 1, 12, 12, 12),
year = new sql.Year(2004),
time = new sql.Time(12,12,12),

//convert years
patio.dateToString(year); //=> '2004'
patio.yearFormat = "yy";
patio.dateToString(year); //=> '04'
patio.yearFormat = patio.DEFAULT_YEAR_FORMAT;
patio.dateToString(year); //=> '2004'

//convert times
patio.dateToString(time); //=> '12:12:12'

//convert dates
patio.dateToString(date); //=> '2004-02-01'
patio.dateFormat = patio.TWO_YEAR_DATE_FORMAT;
patio.dateToString(date); //=> '04-02-01'
patio.dateFormat = patio.DEFAULT_DATE_FORMAT;
patio.dateToString(date); //=> '2004-02-01'

//convert dateTime
patio.dateToString(dateTime); //=> '2004-02-01 12:12:12'
patio.dateTimeFormat = patio.DATETIME_TWO_YEAR_FORMAT;
patio.dateToString(dateTime); //=> '04-02-01 12:12:12'
patio.dateTimeFormat = patio.DATETIME_FORMAT_TZ;
patio.dateToString(dateTime); //=> '2004-02-01 12:12:12-0600'
patio.dateTimeFormat = patio.ISO_8601;
patio.dateToString(dateTime); //=> '2004-02-01T12:12:12-0600'
patio.dateTimeFormat = patio.ISO_8601_TWO_YEAR;
patio.dateToString(dateTime); //=> '04-02-01T12:12:12-0600'
patio.dateTimeFormat = patio.DEFAULT_DATETIME_FORMAT;
patio.dateToString(dateTime); //=> '2004-02-01 12:12:12'

//convert timestamps
patio.dateToString(timeStamp); //=> '2004-02-01 12:12:12'
patio.timeStampFormat = patio.TIMESTAMP_TWO_YEAR_FORMAT;
patio.dateToString(timeStamp); //=> '04-02-01 12:12:12'
patio.timeStampFormat = patio.TIMESTAMP_FORMAT_TZ;
patio.dateToString(timeStamp); //=> '2004-02-01 12:12:12-0600'
patio.timeStampFormat = patio.ISO_8601;
patio.dateToString(timeStamp); //=> '2004-02-01T12:12:12-0600'
patio.timeStampFormat = patio.ISO_8601_TWO_YEAR;
patio.dateToString(timeStamp); //=> '04-02-01T12:12:12-0600'
patio.timeStampFormat = patio.DEFAULT_TIMESTAMP_FORMAT;
patio.dateToString(timeStamp); //=> '2004-02-01 12:12:12'

@param {Date\patio.sql.Time|patio.sql.Year|patio.sql.DateTime|patio.sql.TimeStamp} dt the date to covert to to a string.

@returns {String} the date string.
Converts a date to a string .