Converting Excel Date Serial Number to Date using Javascript
Source: http://stackoverflow.com/a/16233621/336596
@param {[type]} serial a date value in "Excel Date Serial" format
778409
function ExcelDateToJSDate(serial) {
  var utc_days = Math.floor(serial - 25569);
  var utc_value = utc_days * 86400;
  var date_info = new Date(utc_value * 1000);

  var fractional_day = serial - Math.floor(serial) + 0.0000001;

  var total_seconds = Math.floor(86400 * fractional_day);

  var seconds = total_seconds % 60;

  total_seconds -= seconds;

  var hours = Math.floor(total_seconds / (60 * 60));
  var minutes = Math.floor(total_seconds / 60) % 60;

  return new Date(
    date_info.getFullYear(),
    date_info.getMonth(),
    date_info.getDate(),
    hours,
    minutes,
    seconds
  );
}
988686
function(date, showSeconds) {
			if(typeof showSeconds === "undefined") {
				showSeconds = true;
			}

			if(!date) {
				date = this.getDateObject();
			}

			console.log(date);

			
			var hours = date.getHours();
			var merid = hours > 12 ? 'PM' : 'AM';
			var data   = [
				hours > 12 ? hours - 12 : (hours === 0 ? 12 : hours),
				date.getMinutes()			
			];

			if(showSeconds === true) {
				data.push(date.getSeconds());
			}

			return this.digitize(data);
		}
544677
function baseToDate(r) {
  var ms = r[7] ? (r[7] + '00').slice(0, 3) : 0;
  var date = getValidDate(+r[1], +r[2], +r[3], +(r[4] || 0), +(r[5] || 0), +(r[6] || 0), +ms);

  if (date) {
    // GMT+h:mm
    if (r[8]) {
      var h = +r[8];
      var m = +(r[9] || 0);
      if (-12 <= h && h <= 12 && 0 <= m && m < 60) {
        var diff = date.getTimezoneOffset() + (h * 60 + m);
        date.setTime(date.getTime() - diff * 60000);
      } else {
        date = null;
      }

    // Z
    } else if (r[10]) {
      date.setTime(date.getTime() - date.getTimezoneOffset() * 60000);
    }
  }

  return date;
}
718181
function getDate(node) {
    var text = getText(node);
    if (!text) {
        return undefined;
    }
    if (text.indexOf(':') > 0) {
        return new Date(text);
    }
    var bytes = new DataView(ByteUtils.arrayToBuffer(ByteUtils.base64ToBytes(text)));
    var secondsFrom00 = new Int64(bytes.getUint32(0, true), bytes.getUint32(4, true)).value;
    var diff = (secondsFrom00 - EpochSeconds) * 1000;
    return new Date(diff);
}
337388
@Deprecated
	public ChainWriter printDateJS(long date, Sequence sequence, Appendable scriptOut) throws IOException {
		return writeDateJavaScript(date==-1 ? null : new Date(date), sequence, scriptOut);
	}
1358701
function () {
		var columns = this.columns,
			col = columns.length, 
			row,
			val,
			floatVal,
			trimVal,
			dateVal;
			
		while (col--) {
			row = columns[col].length;
			while (row--) {
				val = columns[col][row];
				floatVal = parseFloat(val);
				trimVal = this.trim(val);

				/*jslint eqeq: true*/
				if (trimVal == floatVal) { // is numeric
				/*jslint eqeq: false*/
					columns[col][row] = floatVal;
					
					// If the number is greater than milliseconds in a year, assume datetime
					if (floatVal > 365 * 24 * 3600 * 1000) {
						columns[col].isDatetime = true;
					} else {
						columns[col].isNumeric = true;
					}					
				
				} else { // string, continue to determine if it is a date string or really a string
					dateVal = this.parseDate(val);
					
					if (col === 0 && typeof dateVal === 'number' && !isNaN(dateVal)) { // is date
						columns[col][row] = dateVal;
						columns[col].isDatetime = true;
					
					} else { // string
						columns[col][row] = trimVal === '' ? null : trimVal;
					}
				}
				
			}
		}
	}
326834
function SimpleDate(){
    this._monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
    this._monthNamesShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

    var tempDate = new Date();
    this.setYear(tempDate.getFullYear());
    this.setMonth(tempDate.getMonth());
    this.setDate(tempDate.getDate());

    if(arguments[0] != null) {
        if (arguments[0] instanceof Date) {
            tempDate = arguments[0];

            this.setYear(tempDate.getFullYear());
            this.setMonth(tempDate.getMonth());
            this.setDate(tempDate.getDate());
        } else if(arguments[0] instanceof SimpleDate) {
            this.setYear(arguments[0].getYear());
            this.setMonth(arguments[0].getMonth());
            this.setDate(arguments[0].getDate());
        } else if(arguments[0] instanceof Object) {
            var obj = arguments[0];
            if(obj.year != null && obj.month != null && obj.date != null) {
                this.setYear(obj.year);
                this.setMonth(obj.month);
                this.setDate(obj.date);
            } else {
                this.setYear(tempDate.getFullYear());
                this.setMonth(tempDate.getMonth());
                this.setDate(tempDate.getDate());
            }
        }else {
            try {
                this.setYear(parseInt(arguments[0]));
                this.setMonth(parseInt(arguments[1]));
                this.setDate(parseInt(arguments[2]));
            }catch(e) {
                this.setYear(tempDate.getFullYear());
                this.setMonth(tempDate.getMonth());
                this.setDate(tempDate.getDate());
            }
        }
    }
}
1103914
function(date) {    
            function format(number) {
                // Format integers to have at least two digits.
                return (number < 10) ? '0' + number : number;
            }
            return '"' + date.getFullYear() + '-' +
                    format(date.getMonth() + 1) + '-' +
                    format(date.getDate()) + 'T' +
                    format(date.getHours()) + ':' +
                    format(date.getMinutes()) + ':' +
                    format(date.getSeconds()) + '"';
        }
241677
function serialEach(object, fn, callback) {
  var keys = Object.keys(object);
  next();
  function next(err) {
    if (err) return callback(err);
    var key = keys.shift();
    if (!key) return callback();
    fn(key, object[key], next);
  }
}
690687
function (data) {
                        // convert {0: "Jan", 1: "Feb", ...} to ["Jan", "Feb", ...]
                        return (Object.keys(data) || []).reduce(
                            function (rslt, el) {
                                rslt.push(data[el]);
                                return rslt;
                            },
                            []
                        );
                    }
655779
function formatDate(date) {
  let timestamp;
  if (date instanceof Date) {
    // Datadog expects seconds.
    timestamp = Math.round(date.getTime() / 1000);
  } else if (date instanceof Number) {
    // Make sure it is an integer, not a float.
    timestamp = Math.round(date);
  }
  return timestamp;
}
395467
function tlid__toDate(str) {
  // var dt = new Date(str); //@s 181223 Wont work as it require "-"
  var tlidValue = tlid__xtr(str);
  var r = "";

  var y = "20" + getchk_sub(tlidValue, 0, 2); // will bug in 82 years, well, I am not pessimistic here but possibly will not be there or if I do, I wont care so much... I must add a reminder for 2099/12/31 to update tlid.todate.... ;)

  var m = getchk_sub(tlidValue, 2, 4) - 1;
  var d = getchk_sub(tlidValue, 4, 6);

  r = `${y}/${m != "" ? m : 1}/${d != "" ? d : 1}`;

  if (debugDt) console.log(`Year: ${y}`);
  if (debugDt) console.log(`Month: ${m}`);
  if (debugDt) console.log(`Day: ${d}`);
  var h = "00";
  var M = "00";
  var s = "00";
  var ms = "000";

  try {

    h = getchk_sub(tlidValue, 6, 8);
    if (debugDt) console.log(`Hour: ${h}`);




    M = getchk_sub(tlidValue, 8, 10);
    if (debugDt) console.log(`Minutes: ${M}`);



    s = getchk_sub(tlidValue, 10, 12);
    if (debugDt) console.log(`Seconds: ${s}`);



    ms = getchk_sub(tlidValue, 12, 13);
    ms = getchk_sub(tlidValue, 12, 14);
    ms = getchk_sub(tlidValue, 12, 15);
    ms = getchk_sub(tlidValue, 12, 16);

    if (debugDt) console.log(`MiliSeconds: ${ms}`);


  } catch (error) {

  }
  if (debugDt) console.log("R: " + r);

  var dt = new Date(r);

  if (y != "")
    if (m != "")
      if (d != "")
        if (h != "")
          if (M != "")
            if (s != "")
              if (ms != "")
                dt = new Date(Date.UTC(y, m, d, h, M, s, ms));
              else
                dt = new Date(Date.UTC(y, m, d, h, M, s));
            else
              dt = new Date(Date.UTC(y, m, d, h, M));
          else
            dt = new Date(Date.UTC(y, m, d, h));
        else
          dt = new Date(Date.UTC(y, m, d));
      else
        dt = new Date(Date.UTC(y, m));
    else
      dt = new Date(Date.UTC(y));

  if (debugDt) console.log("TZ: " + dt.getTimezoneOffset());

  return dt;
}
673583
public static Date getDate(
    Object   value)
  {
    if (value == null)
    {
        return null;
    }

    if (value instanceof Date)
    {
        return ((Date) value);
    }

    return parseISODate(value.toString());
  }
486560
function parseISO8601(str) {
    if (Date.prototype.toISOString) {
        return new Date(str);
    } else {
        var parts = str.split('T'),
            dateParts = parts[0].split('-'),
            timeParts = parts[1].split('Z'),
            timeSubParts = timeParts[0].split(':'),
            timeSecParts = timeSubParts[2].split('.'),
            timeHours = Number(timeSubParts[0]),
            _date = new Date();

        _date.setUTCFullYear(Number(dateParts[0]));
        _date.setUTCDate(1);
        _date.setUTCMonth(Number(dateParts[1])-1);
        _date.setUTCDate(Number(dateParts[2]));
        _date.setUTCHours(Number(timeHours));
        _date.setUTCMinutes(Number(timeSubParts[1]));
        _date.setUTCSeconds(Number(timeSecParts[0]));
        if (timeSecParts[1]) {
            _date.setUTCMilliseconds(Number(timeSecParts[1]));
        }

        return _date;
    }
}
792092
function formatDate( date ) {

	var dateString = '';

	date = new Date( date );

	dateString = date.getMonth() + 1;
	dateString += '/';
	dateString += date.getDate();
	dateString += '/';
	dateString += date.getFullYear();

	return dateString;
}
1204001
private static String getDateString(Date date) {
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
		return "'" + df.format(date) + "'";
	}
304063
function convertDateType (data) {
  switch (data.type) {
    case 'date-only':
      data['type'] = 'string'
      data['pattern'] = constants.dateOnlyPattern
      break
    case 'time-only':
      data['type'] = 'string'
      data['pattern'] = constants.timeOnlyPattern
      break
    case 'datetime-only':
      data['type'] = 'string'
      data['pattern'] = constants.dateTimeOnlyPattern
      break
    case 'datetime':
      data['type'] = 'string'
      if (data.format === undefined || data.format.toLowerCase() === constants.RFC3339) {
        data['pattern'] = constants.RFC3339DatetimePattern
      } else if (data.format.toLowerCase() === constants.RFC2616) {
        data['pattern'] = constants.RFC2616DatetimePattern
      }
      delete data.format
      break
  }
  return data
}