AMF3 Encode Date
@param ts
@returns {Buffer}
547235
function amf3encDate(ts) {
    var buf = new Buffer(1);
    buf.writeUInt8(0x8, 0);
    var tsBuf = new Buffer(8);
    tsBuf.writeDoubleBE(ts, 0);
    return Buffer.concat([buf, amf3encUI29(1), tsBuf]); // We always do 1
}
695344
function formatDate(date, format)
  {
    let parsedDate = new Date(date)
    if (!isDate(parsedDate))
      throw new TypeError("A date or timestamp must be provided to {{formatDate}}")

    if (isString(format) && format in formats.date)
      format = formats.date[format]

    return getCachedDateTimeFormat(locale, format).format(parsedDate)
  }
1228272
def _encode_timestamp(name, value, dummy0, dummy1):
    """"""
    return b"\x11" + name + _PACK_TIMESTAMP(value.inc, value.time)
761293
function(arg) {
  var args = Array.isArray(arg) ? arg : Array.apply(null, arguments);
  lastMsgDate = new Date();
  fs.write(tempFile, JSON.stringify(args) + '\n', 'a');
}
614292
function amf0encUString(s) {
    var data = new Buffer(s,'utf8');
    var sLen = new Buffer(2);
    sLen.writeUInt16BE(data.length,0);
    return Buffer.concat([sLen,data]);
}
61812
def to_ts(date: datetime.date) -> float:
    
    return datetime.datetime(
        date.year, date.month, date.day,
        tzinfo=datetime.timezone.utc).timestamp()
897579
function timestamp(){

    var date = new Date();

    // Munge.
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = (m < 10 ? "0" : "") + m;
    var d = date.getDate();
    d = (d < 10 ? "0" : "") + d;
    var h = date.getHours();
    h = (h < 10 ? "0" : "") + h;
    var min = date.getMinutes();
    min = (min < 10 ? "0" : "") + m;
    var s = date.getSeconds();
    s = (s < 10 ? "0" : "") + s;

    // Assemble.
    return y +"-"+ m +"-"+ d + "T" + h + ":" + min + ":" + s;
}
533573
function (timestamp) {
        var date = (new Date(timestamp)).toDateString();
        return {
            msg       : date,
            msgLength : date.length
        };
    }
770908
function amfXDecode(rules, buffer) {
    // We shall receive clean buffer and will respond with an array of values
    var resp = [];
    var res;
    for (var i = 0; i < buffer.length;) {
        res = amfXDecodeOne(rules, buffer.slice(i));
        i += res.len;
        resp.push(res.value); // Add the response
    }
    return resp;
}
389600
function timestamp () {
  const date = new Date()

  return [
    zeropad(date.getHours()),
    zeropad(date.getMinutes()),
    zeropad(date.getSeconds())
  ].join(':')
}
1024837
function decodePeriodTime(map, timeStr, type){
  let times = timeStr.split('/');
  let min = Limit[type][0];
  let max = Limit[type][1];

  let remind = Number(times[0]);
  let period = Number(times[1]);

  if(period==0)
    return;

  for(let i = min; i <= max; i++){
    if(i%period == remind)
      map[i] = i;
  }
}
571015
function toDate(str) {
  var millis = Date.parse(str);
  if (isNaN(millis)) {
    throw new Error(l10n.lookupFormat('typesDateNan', [ str ]));
  }
  return new Date(millis);
}
587212
function(inst, date) {
		var minDate = this._getMinMaxDate(inst, 'min');
		var maxDate = this._getMinMaxDate(inst, 'max');
		return ((!minDate || date.getTime() >= minDate.getTime()) &&
			(!maxDate || date.getTime() <= maxDate.getTime()));
	}
1109671
def encode_with_ts(value)
      # Not sure if this object is thread-safe, so we re-create
      # each time. 

      public_key = OpenSSL::PKey::RSA.new(self.public_key_str)

      payload = "#{value}|#{self.now_timestamp}"

      return Base64.encode64(public_key.public_encrypt(payload))
    end
223440
def _encode_time(mtime: float):
    """"""
    dt = arrow.get(mtime)
    dt = dt.to("local")
    date_val = ((dt.year - 1980) << 9) | (dt.month << 5) | dt.day
    secs = dt.second + dt.microsecond / 10**6
    time_val = (dt.hour << 11) | (dt.minute << 5) | math.floor(secs / 2)
    return (date_val << 16) | time_val
208549
function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true
	if (typeof s == 'object') { // already a Date object
		return s;
	}
	if (typeof s == 'number') { // a UNIX timestamp
		return new Date(s * 1000);
	}
	if (typeof s == 'string') {
		if (s.match(/^\d+(\.\d+)?$/)) { // a UNIX timestamp
			return new Date(parseFloat(s) * 1000);
		}
		if (ignoreTimezone === undefined) {
			ignoreTimezone = true;
		}
		return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null);
	}
	// TODO: never return invalid dates (like from new Date(<string>)), return null instead
	return null;
}
1083027
function fidjTimestampFormat(timestamp) {
    var date = new Date(timestamp);
    return fidjPadNumber(date.getFullYear(), 4) + '-' +
        fidjPadNumber(date.getMonth() + 1, 2) + '-' +
        fidjPadNumber(date.getDate(), 2) + ' ' +
        fidjPadNumber(date.getHours(), 2) + ':' +
        fidjPadNumber(date.getMinutes(), 2) + ':' +
        fidjPadNumber(date.getSeconds(), 2);
}