Stringify the parameter value in an appropriate way. Note that Facebook fucks up dates by using unix time-since-epoch
some places and ISO-8601 others. However, maybe unix times always work as parameters?
501921
public static String stringifyValue(Param param, ObjectMapper mapper) {
		assert !(param instanceof BinaryParam);
		
		if (param.value instanceof String)
			return (String)param.value;
		if (param.value instanceof Date)
			return Long.toString(((Date)param.value).getTime() / 1000);
		else if (param.value instanceof Number)
			return param.value.toString();
		else
			return JSONUtils.toJSON(param.value, mapper);
	}
1062752
def valueFromString(self, value, context=None):
        
        if value in ('today', 'now'):
            return datetime.date.utcnow()

        try:
            return datetime.datetime.fromtimestamp(float(value))
        except StandardError:
            if dateutil_parser:
                return dateutil_parser.parse(value)
            else:
                return datetime.datetime.min()
280604
def date_to_string(date)
      precision = date.precision
      if CarbonDate::Date::PRECISION.include? precision # Call me paranoid: whitelist the available functions
        public_send(precision, date)
      else
        raise StandardError.new("Unrecognized precision: #{precision}")
      end
    end
1202998
function(value, options) {
    var format = options.dateOnly ?
      '{yyyy}-{MM}-{dd}' :
      '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}';

    var d = FxoUtils.parseDateTimeField(value);
    return d.parsed.format(format);
  }
421052
function fixInvalidDate(dateString) {
  if (!dateString) {
    return;
  }

  //Convert invalid dates' timezones to GMT using timezoneMap
  dateString = dateString.replace(/BST?/i, function (match) {
    return timezoneMap[match];
  });

  //Some dates come in as ET, CT etc.. and some don't have the correct offset.
  //Matches /ET/EDT/EST/CT/CDT/CST/MT/MDT/MST/PT/PDT/PST if found at the end of a date string
  var newDateString = dateString.replace(/(E|C|M|P)[DS+]?T$/i, function (match) {
    var firstChar = match.charAt(0);
    return isDaylightSavingsTime() ? (firstChar + 'DT') : (firstChar + 'ST');
  });

  return new Date(newDateString);
}
1126798
def to_gremlin(self):
        """"""
        # We can't directly pass a Date or a DateTime object, so we have to pass it as a string
        # and then parse it inline. For date format parameter meanings, see:
        # http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
        if GraphQLDate.is_same_type(self.inferred_type):
            return u'Date.parse("{}", {})'.format(STANDARD_DATE_FORMAT, self.variable_name)
        elif GraphQLDateTime.is_same_type(self.inferred_type):
            return u'Date.parse("{}", {})'.format(STANDARD_DATETIME_FORMAT, self.variable_name)
        else:
            return six.text_type(self.variable_name)
222181
def valueFromString(self, value, context=None):
        
        if value in ('today', 'now'):
            return datetime.date.today()
        elif dateutil_parser:
            return dateutil_parser.parse(value).date()
        else:
            time_struct = time.strptime(value, self.defaultFormat())
            return datetime.date(time_struct.tm_year,
                                 time_struct.tm_month,
                                 time_struct.tm_day)
677696
function _dateString() {
  var now=new Date();
  return util.format("%d_%d_%d:%d_%d_%d", 
                     now.getFullYear(),now.getMonth()+1,now.getDate(), 
                     now.getHours(), now.getMinutes(), now.getSeconds());
}
36951
function(method, url, date) {
        var timestamp = (date || new Date()).toISOString().replace(/\.\d+Z$/, 'Z'),
            addPubKey = this.options.user !== this.options.publicKey,
            qs = url.toString().indexOf('?') > -1 ? '&' : '?',
            signUrl = addPubKey ? url + qs + 'publicKey=' + this.options.publicKey : url,
            signature = this.generateSignature(method, signUrl.toString(), timestamp);

        qs = addPubKey ? '&' : qs;
        qs += 'signature=' + encodeURIComponent(signature);
        qs += '&timestamp=' + encodeURIComponent(timestamp);

        return signUrl + qs;
    }
1356143
function toLocalIsoString(date, includeMillis) {
    if (includeMillis === undefined) {
        includeMillis = false;
    }
    const pad = (n, length, padChar) => {
        if (length === undefined) { length = 2; }
        if (padChar === undefined) { padChar = "0"; }
        let str = "" + n;
        while (str.length < length) {
            str = padChar + str;
        }
        return str;
    };
    const getOffsetFromUTC = () => {
        const offset = date.getTimezoneOffset();
        if (offset === 0) {
            return "Z";
        }
        return (offset < 0 ? "+" : "-")
            + pad(Math.abs(offset / 60), 2) + ":"
            + pad(Math.abs(offset % 60), 2);
    };
    return date.getFullYear() + "-"
        + pad(date.getMonth() + 1) + "-"
        + pad(date.getDate()) + "T"
        + pad(date.getHours()) + ":"
        + pad(date.getMinutes()) + ":"
        + pad(date.getSeconds())
        + (includeMillis ? "." + pad(date.getMilliseconds(), 3) : "")
        + getOffsetFromUTC();
}
188585
def _serialize_date(value):
    """"""
    if not isinstance(value, date):
        raise ValueError(u'The received object was not a date: '
                         u'{} {}'.format(type(value), value))
    return value.isoformat()
489209
function getTimestampString(date) {
    // all this nasty code is faster (~30k ops/sec) than doing "moment(date).format('HH:mm:ss:SSS')" and means 0 dependencies
    var hour = '0' + date.getHours();
    hour = hour.slice(hour.length - 2);
    var minute = '0' + date.getMinutes();
    minute = minute.slice(minute.length - 2);
    var second = '0' + date.getSeconds();
    second = second.slice(second.length - 2);
    var ms = '' + date.getMilliseconds();

    // https://github.com/MarkHerhold/palin/issues/6
    // this is faster than using an actual left-pad algorithm
    if (ms.length === 1) {
        ms = '00' + ms;
    } else if (ms.length === 2) {
        ms = '0' + ms;
    } // no modifications for 3 or more digits

    return chalk.dim(`${hour}:${minute}:${second}:${ms}`);
}
754182
private String encodeDate(TimeZone browserTZ, TimeZone targetTZ, Date utcDate) {
        return "new Date(" + DateUtils.toLocalDate(browserTZ, targetTZ, utcDate) + ")";
    }
1042638
def set!(date)
      date = Date.parse date if date.is_a?(String)

      message = "DateField##{__callee__} only accepts instances of Date or Time"
      raise ArgumentError, message unless [Date, ::Time].include?(date.class)

      date_string = date.strftime('%Y-%m-%d')
      element_call(:wait_for_writable) { execute_js(:setValue, @element, date_string) }
    end
436962
def match_date(self, value, strict=False):
        """"""
        value = stringify(value)
        try:
            parse(value)
        except Exception:
            self.shout('Value %r is not a valid date', strict, value)
435784
private void appendDateTime(long epochMillis) {
        date.setTime(epochMillis);
        calendar.setTime(date);
        appendDate();
        write(' ');
        appendTime();
    }
335312
function getDate (type, min, max, format, options) {
  var ret;

  // Juggle the arguments if the user didn't supply a format string
  if (!options) {
    options = format;
    format = null;
  }

  if (type === 'date') {
    min = Date.parse(min);
    max = Date.parse(max);
  } else if (type === 'time') {
    min = Date.parse('1970-01-01T' + min);
    max = Date.parse('1970-01-01T' + max);
  }

  ret = utils.randomDate(min, max);

  if (format === 'unix') {
    // We need to undo the timezone offset fix from utils.randomDate()
    ret = Math.floor((ret.getTime() - ret.getTimezoneOffset() * 60000) / 1000);
  } else if (format) {
    ret = fecha.format(ret, format);
  } else if (type === 'time') {
    // Time has a default format if one is not specified
    ret = fecha.format(ret, 'HH:mm');
  }

  return ret;
}