Recursively go through object and convert dates
@param 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;
    }
1245325
private void setObjectDefaults(DigitalObject obj) {
        if (obj.getCreateDate() == null) obj.setCreateDate(m_now);
        if (obj.getLastModDate() == null) obj.setLastModDate(m_now);

        Iterator<String> dsIds = obj.datastreamIdIterator();
        while (dsIds.hasNext()) {
            String dsid = dsIds.next();
            for (Datastream ds : obj.datastreams(dsid)) {
                ds.DSSize = 0;
                if (ds.DSCreateDT == null) {
                    ds.DSCreateDT = m_now;
                }
            }
        }
    }
1138553
function jsonConverter(value, key, obj) {
    if (value !== null && typeof value === 'object') {
      // Recurse into children
      _.each(value, jsonConverter);
    } else if (typeof value === 'string') {
      // handle special cases (regex/number/date)
      if (key === '$regex') {
        const m = value.match(/\/(.*)\//);
        if (m) {
          if (obj.$options) {
            m[2] = obj.$options;
            // eslint-disable-next-line no-param-reassign
            delete obj.$options;
          }
          // eslint-disable-next-line no-param-reassign
          obj[key] = new RegExp(m[1], m[2]);
        }
      } else if (/^oid:[a-fA-F0-9]{24}$/.test(value)) {
        // eslint-disable-next-line no-param-reassign, prefer-destructuring
        obj[key] = value.split(':')[1];
      } else {
        // check if date to convert it
        const date = parseDateCustom(value);
        if (!Number.isNaN(date)) {
          // eslint-disable-next-line no-param-reassign
          obj[key] = date;
        }
      }
    }
  }
220670
@Override
	public Date deserialize(Long value) {
		if (value != null) {
			return new Date(value);
		}
		return null;
	}
298929
function(obj)
    {
        return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime());
    }
495823
@SuppressWarnings("unchecked")
    public Object transform(final Object obj) {
        if (obj != null && !(obj instanceof BeanMap)) {
            Class clazz = obj.getClass();
            if (clazz.isArray()) {
                return _transform((Object[]) obj);
            } else if (obj instanceof Map) {
                return _transform((Map) obj);
            } else if (obj instanceof List) {
                return _transform((List) obj);
            } else if (obj instanceof Set) {
                return _transform((Set) obj);
            } else if (obj instanceof Collection) {
                return _transform((Collection) obj);
            } else if (obj instanceof Iterable) {
                return _transform((Iterable) obj);
            } else if (obj instanceof Iterator) {
                return _transform((Iterator) obj);
            } else if (needTransform(obj)) {
                return onTransform(obj);
            }
        }
        return obj;
    }
270896
@NonNull
    @Override
    public MutableDictionary setDate(@NonNull String key, Date value) {
        return setValue(key, value);
    }
691915
private JSONArray datesToJson(Collection<Date> individualDates) {

        if (null != individualDates) {
            JSONArray result = new JSONArray();
            for (Date d : individualDates) {
                result.put(dateToJson(d));
            }
            return result;
        }
        return null;
    }
128956
def convert_timestamps(obj):
    
    for key in ('date', 'when', 'end', 'start_date', 'end_date'):
        value = obj.get(key)
        if value:
            try:
                obj[key] = _timestamp_to_dt(value)
            except TypeError:
                raise TypeError("expected float for %s, got %s" % (key, value))

    for key in ('sources', 'actions', 'votes', 'roles'):
        for child in obj.get(key, []):
            convert_timestamps(child)

    return obj
668178
private SortedSet<Date> readDates(JSONArray array) {

        if (null != array) {
            SortedSet<Date> result = new TreeSet<>();
            for (int i = 0; i < array.length(); i++) {
                try {
                    long l = Long.valueOf(array.getString(i)).longValue();
                    result.add(new Date(l));
                } catch (NumberFormatException | JSONException e) {
                    LOG.error("Could not read date from JSON array.", e);
                }
            }
            return result;
        }
        return new TreeSet<>();
    }
660801
def object_deserializer(obj):
    
    for key, val in obj.items():
        if isinstance(val, six.string_types) and DATETIME_REGEX.search(val):
            try:
                obj[key] = dates.localize_datetime(parser.parse(val))
            except ValueError:
                obj[key] = val
    return obj
345343
@Override
    public Calendar convertDateToCalendar(java.util.Date date) {
        Calendar calendar = null;
        if (date != null) {
            calendar = Calendar.getInstance();
            calendar.setTime(date);
            calendar.clear(Calendar.ZONE_OFFSET);
            calendar.clear(Calendar.DST_OFFSET);
        }
        return calendar;
    }
635136
function Facade (obj) {
  obj = clone(obj);
  if (!obj.hasOwnProperty('timestamp')) obj.timestamp = new Date();
  else obj.timestamp = newDate(obj.timestamp);
  traverse(obj);
  this.obj = obj;
}
996175
function deserializeAllDates(model, json) {
	_.each(json, function (value, name) {
		if ( !_.isDate( value ) && !isBackboneInstance( value ) ) {
			if ( _.isString( value ) && model.isSerializedDate( name, value ) ) {
				json[ name ] = model.deserializeDate( name, value );
			} else if ( !isScalar( value ) && isRecursive( value ) ) {
				deserializeAllDates( model, value );
			}
		}
	});

	return json;
}
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
1245598
@Override
    public void visitCode(Code obj) {
        try {
            userValues = new HashMap<>();
            loops = new HashMap<>();
            isInstanceMethod = !getMethod().isStatic();
            super.visitCode(obj);
        } finally {
            userValues = null;
            loops = null;
        }
    }
906318
function(oData) {
    var date = null;
    
    //Convert to date
    if(!(oData instanceof Date)) {
        date = new Date(oData);
    }
    else {
        return oData;
    }
    
    // Validate
    if(date instanceof Date) {
        return date;
    }
    else {
        YAHOO.log("Could not convert data " + lang.dump(oData) + " to type Date", "warn", this.toString());
        return null;
    }
}