Recursively ISO format all time and date values.

 @param [Hash] obj the object containing date or time objects
 @return [Hash] the object with ISO-formatted time stings
518221
def stringify_times(obj)
      case obj
      when Hash
        Hash[obj.map { |k,v| [k, stringify_times(v)] }]
      when Array
        obj.map { |v| stringify_times(v) }
      else
        iso_format_time(obj)
      end
    end
1295484
function(date, time, format) {
			var isodate = new modules.ISODate(date, format),
				isotime = new modules.ISODate();

			isotime.parseTime(this.parseAmPmTime(time), format);
			if(isodate.hasFullDate() && isotime.hasTime()) {
				isodate.tH = isotime.tH;
				isodate.tM = isotime.tM;
				isodate.tS = isotime.tS;
				isodate.tD = isotime.tD;
				return isodate;
			} else {
				if(isodate.hasFullDate()){
					return isodate;
				}
				return new modules.ISODate();
			}
		}
688984
function object (obj, strict) {
  each(obj, function (key, val) {
    if (isodate.is(val, strict)) {
      obj[key] = isodate.parse(val);
    } else if (is.object(val) || is.array(val)) {
      traverse(val, strict);
    }
  });
  return obj;
}
875653
function getDateTime(obj) {

    // get date, hour, minute, second, year, month and day
    var date = new Date()
      , hour = date.getHours()
      , min  = date.getMinutes()
      , sec  = date.getSeconds()
      , year = date.getFullYear()
      , month = date.getMonth() + 1
      , day  = date.getDate()
      ;

    // add `0` if needed
    hour  = padWithZero(hour);
    min   = padWithZero(min);
    sec   = padWithZero(sec);
    month = padWithZero(month);
    day   = padWithZero(day);

    // obj is true, return an object
    if (obj) {
        return {
            year: year,
            month: parseInt(month),
            day: parseInt(day),
            cDay: date.getDay()
        }
    }

    // return a string
    return year + "-" + month + "-" + day;
}
298929
function(obj)
    {
        return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime());
    }
830781
def format_obj( obj )
    case obj
    when String; obj
    when Exception
      lines = ["<#{obj.class.name}> #{obj.message}"]
      lines.concat(obj.backtrace) if backtrace? && obj.backtrace
      format_cause(obj, lines)
      lines.join("\n\t")
    when nil; "<#{obj.class.name}> nil"
    else
      str = "<#{obj.class.name}> "
      str << case @obj_format
             when :inspect; obj.inspect
             when :yaml; try_yaml(obj)
             when :json; try_json(obj)
             else obj.to_s end
      str
    end
  end
969857
public Date makeDateFrom( Object obj )
  {
    if( obj == null )
    {
      return null;
    }

    if( obj instanceof IDimension )
    {
      obj = ((IDimension)obj).toNumber();
    }

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

    if( obj instanceof Number )
    {
      return new Date( ((Number)obj).longValue() );
    }

    if( obj instanceof Calendar)
    {
      return ((Calendar)obj).getTime();
    }

    if( !(obj instanceof String) )
    {
      obj = obj.toString();
    }

    try
    {
      return parseDateTime( (String)obj );
    }
    catch( Exception e )
    {
      //e.printStackTrace();
    }

    return null;
  }
736866
def encode_date_optional_time(obj):
    
    if isinstance(obj, datetime.datetime):
        return timezone("UTC").normalize(obj.astimezone(timezone("UTC"))).strftime('%Y-%m-%dT%H:%M:%SZ')
    raise TypeError("{0} is not JSON serializable".format(repr(obj)))
495087
function serializeAllDates(obj) {

        // if it is a date, then return serialized version
        if (_.isDate(obj)) {
            return serializeDate(obj);
        }

        // if array or object, loop over it
        if (_.isArray(obj) || _.isObject(obj)) {
            _.forEach(obj, function (item, key) {
                obj[key] = serializeAllDates(item);
            });
        }

        return obj;
    }
957254
protected function extractDatetimeValue($obj_property)
    {
        // Attempt to retain microsecond precision
        return \DateTime::createFromFormat(
            self::DATETIME_FORMAT_UDOTU,
            sprintf('%0.6F', bcdiv($obj_property->getTimestampMicrosecondsValue(), self::MICROSECONDS))
        );

        // Works, to seconds only
        // return (new \DateTime())->setTimestamp($obj_property->getTimestampMicrosecondsValue() / self::MICROSECONDS);
    }
760226
def parse(date_time)
      raise(ISO8601::Errors::UnknownPattern, date_time) if date_time.empty?

      date, time = date_time.split('T')

      date_atoms = parse_date(date)
      time_atoms = Array(time && parse_time(time))
      separators = [date_atoms.pop, time_atoms.pop]

      raise(ISO8601::Errors::UnknownPattern, @original) unless valid_representation?(date_atoms, time_atoms)
      raise(ISO8601::Errors::UnknownPattern, @original) unless valid_separators?(separators)

      ::DateTime.new(*(date_atoms + time_atoms).compact)
    end
209629
def FormatSOAPDateTime(value):
  
  value_date = value['date']
  return '%s-%s-%s %s:%s:%s (%s)' % (
      value_date['year'], value_date['month'], value_date['day'],
      value['hour'], value['minute'], value['second'], value['timeZoneId'])
432186
def fmt_date(date)
      return nil if date.blank?
      return nil unless (date.is_a?(String) || date.is_a?(Date) || date.is_a?(Time))
      unless date.is_a?(String)
        date = date.to_s(:date4)
      end
      m,d,y = date.split('/')
      "#{m.to_i}/#{d.to_i}/#{y.to_i}"
    end
323727
def transformFromNative(obj):
        
        if obj.value and type(obj.value[0]) == datetime.date:
            obj.isNative = False
            obj.value_param = 'DATE'
            obj.value = ','.join([dateToString(val) for val in obj.value])
            return obj
        # Fixme: handle PERIOD case
        else:
            if obj.isNative:
                obj.isNative = False
                transformed = []
                tzid = None
                for val in obj.value:
                    if tzid is None and type(val) == datetime.datetime:
                        tzid = TimezoneComponent.registerTzinfo(val.tzinfo)
                        if tzid is not None:
                            obj.tzid_param = tzid
                    transformed.append(dateTimeToString(val))
                obj.value = ','.join(transformed)
            return obj
569988
function(obj) {
    _.forEach(obj, function(val, key) {
      if (_.isString(val)) {
        if (Mixins.isObjectId(val)) {
          obj[key] = Mixins.newObjectId(val);
        } else if (Mixins.isValidISO8601String(val)) {
          obj[key] = new Date(val);
        }
      } else if (_.isDate(val)) {
        obj[key] = val;
      } else if (_.isObject(val)) {
        if (val['$oid']) {
          obj[key] = val['$oid'];
        } else {
          obj[key] = this.cast(val);
        }
      }
    }.bind(this));

    return obj;
  }
623139
function convertDates (obj, convert) {
  obj = clone(obj);
  for (var key in obj) {
    var val = obj[key];
    if (is.date(val)) obj[key] = convert(val);
    if (is.object(val)) obj[key] = convertDates(val, convert);
  }
  return obj;
}
659034
def parse_object(self, data):
        
        for key, value in data.items():
            if isinstance(value, (str, type(u''))) and \
               self.strict_iso_match.match(value):
                data[key] = dateutil.parser.parse(value)
        return data