MCPcopy Create free account
hub / github.com/CScorza/IntelOSINT / _drive_datetime_utc

Method _drive_datetime_utc

IntelOSINT.py:11367–11402  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

11365 ]
11366
11367 def _drive_datetime_utc(self, value):
11368 if not value:
11369 return "N/D"
11370 raw = str(value).strip()
11371 if not raw or raw.lower() in ("n/a", "na", "none", "null"):
11372 return "N/D"
11373 try:
11374 if raw.isdigit() and len(raw) <= 13:
11375 return datetime.fromtimestamp(int(raw), tz=timezone.utc).strftime("%Y/%m/%d %H:%M:%S")
11376 except Exception:
11377 pass
11378
11379 normalized = raw.replace("Z", "+00:00")
11380 known_formats = [
11381 "%Y-%m-%dT%H:%M:%S.%f%z",
11382 "%Y-%m-%dT%H:%M:%S%z",
11383 "%Y-%m-%dT%H:%M:%S.%f",
11384 "%Y-%m-%dT%H:%M:%S",
11385 "%a, %d %b %Y %H:%M:%S %Z",
11386 "%Y/%m/%d %H:%M:%S",
11387 ]
11388 for fmt in known_formats:
11389 try:
11390 dt = datetime.strptime(normalized, fmt)
11391 if dt.tzinfo is None:
11392 dt = dt.replace(tzinfo=timezone.utc)
11393 return dt.astimezone(timezone.utc).strftime("%Y/%m/%d %H:%M:%S")
11394 except Exception:
11395 pass
11396 try:
11397 dt = datetime.fromisoformat(normalized)
11398 if dt.tzinfo is None:
11399 dt = dt.replace(tzinfo=timezone.utc)
11400 return dt.astimezone(timezone.utc).strftime("%Y/%m/%d %H:%M:%S")
11401 except Exception:
11402 return raw
11403
11404 def _drive_person_from_obj(self, obj):
11405 if not isinstance(obj, dict):

Callers 1

analyze_gdrive_docMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected