JavaScript Python PHP
import * as __biblioteca0 from "@js-temporal/polyfill";
function executar(values = {
input: '2024-01-01T00:00:00.123Z',
direction: 'ISO → Data BR',
unit: 'Segundos',
timezone: 'America/Sao_Paulo'
}) {
const Temporal = __biblioteca0["Temporal"];
const pad = (value, length = 2) => String(value).padStart(length, '0');
function yearRange(year) {
if (year < 1 || year > 9999)
throw new Error('O intervalo suportado é de 0001 a 9999, inclusive no UTC e no fuso selecionado.');
}
function validateTimeZone(zone) {
const value = zone.trim();
try {
if (!value || /^[+-]/.test(value))
throw new Error();
new Intl.DateTimeFormat('en', { timeZone: value }).format(0);
Temporal.Instant.fromEpochMilliseconds(0).toZonedDateTimeISO(value);
return value;
}
catch {
throw new Error('Informe um fuso IANA válido, como America/Sao_Paulo, America/New_York ou UTC.');
}
}
function plain(input, br = false, dateOnly = false) {
const pattern = br ? /^(\d{2})\/(\d{2})\/(\d{4})(?: (\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,3}))?)?$/ : /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,3}))?)?$/;
const match = input.match(pattern);
if (!match || (!dateOnly && !match[4]) || (dateOnly && match[4]))
throw new Error(`Formato esperado: ${br ? 'DD/MM/YYYY' : 'YYYY-MM-DD'}${dateOnly ? '' : ' HH:mm:ss[.SSS]'}.`);
const year = Number(match[br ? 3 : 1]);
yearRange(year);
try {
return Temporal.PlainDateTime.from({ year, month: Number(match[2]), day: Number(match[br ? 1 : 3]), hour: Number(match[4] ?? 0), minute: Number(match[5] ?? 0), second: Number(match[6] ?? 0), millisecond: Number((match[7] ?? '').padEnd(3, '0') || 0) }, { overflow: 'reject' });
}
catch {
throw new Error('Data ou horário impossível. Verifique dia, mês, ano bissexto e horário (00:00:00 a 23:59:59.999).');
}
}
function checkInstant(instant) {
yearRange(instant.toZonedDateTimeISO('UTC').year);
if (instant.epochNanoseconds % BigInt(1000000) !== BigInt(0))
throw new Error('A precisão máxima aceita é de milissegundos (até três casas decimais nos segundos).');
return instant;
}
function parseIsoInstant(input) {
const match = input.trim().match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?)(Z|[+-]\d{2}:\d{2}(?::\d{2})?)$/);
if (!match)
throw new Error('Use YYYY-MM-DDTHH:mm:ss[.SSS]Z ou offset explícito ±HH:mm[:ss]. Precisão máxima: milissegundos.');
plain(match[1]);
try {
return checkInstant(Temporal.Instant.from(match[1] + match[2]));
}
catch (cause) {
throw new Error(`Instante ISO inválido ou fora do intervalo: ${cause instanceof Error ? cause.message : 'verifique o offset'}`);
}
}
function localToInstant(input, zone, br = false) {
const local = plain(input.trim(), br);
const timeZone = validateTimeZone(zone);
try {
return checkInstant(local.toZonedDateTime(timeZone, { disambiguation: 'reject' }).toInstant());
}
catch (cause) {
const earlier = local.toZonedDateTime(timeZone, { disambiguation: 'earlier' });
const later = local.toZonedDateTime(timeZone, { disambiguation: 'later' });
if (earlier.epochNanoseconds !== later.epochNanoseconds) {
const ambiguous = earlier.toPlainDateTime().equals(local) && later.toPlainDateTime().equals(local);
throw new Error(`Horário local ${ambiguous ? 'ambíguo (ocorre duas vezes)' : 'inexistente'} em ${timeZone} por uma transição do fuso. Informe um instante ISO com offset explícito em uma ferramenta que aceite esse formato.`);
}
throw cause;
}
}
function timestampToInstant(input, unit) {
if (!['Segundos', 'Milissegundos'].includes(unit))
throw new Error('Selecione segundos ou milissegundos explicitamente.');
const match = input.trim().match(unit === 'Segundos' ? /^([+-]?)(\d+)(?:\.(\d{1,3}))?$/ : /^([+-]?)(\d+)$/);
if (!match || input.length > 100)
throw new Error('Timestamp inválido: segundos aceitam até três casas decimais; milissegundos exigem inteiro. Não use vírgulas ou notação exponencial.');
const magnitude = BigInt(match[2]) * BigInt(unit === 'Segundos' ? 1000 : 1) + BigInt((match[3] ?? '').padEnd(3, '0') || 0);
const milliseconds = match[1] === '-' ? -magnitude : magnitude;
if (milliseconds < BigInt('-62135596800000') || milliseconds > BigInt('253402300799999'))
throw new Error('Timestamp fora do intervalo suportado: 0001-01-01 a 9999-12-31 em UTC.');
return checkInstant(Temporal.Instant.fromEpochMilliseconds(Number(milliseconds)));
}
function instantToTimestamp(instant, unit) {
checkInstant(instant);
if (unit === 'Milissegundos')
return String(instant.epochMilliseconds);
if (unit !== 'Segundos')
throw new Error('Selecione segundos ou milissegundos explicitamente.');
const ms = BigInt(instant.epochMilliseconds);
const absolute = ms < BigInt(0) ? -ms : ms;
const fraction = absolute % BigInt(1000);
return `${ms < BigInt(0) ? '-' : ''}${absolute / BigInt(1000)}${fraction ? '.' + String(fraction).padStart(3, '0') : ''}`;
}
function localText(date, br = false) {
const day = br ? `${pad(date.day)}/${pad(date.month)}/${pad(date.year, 4)}` : date.toPlainDate().toString();
return `${day} ${pad(date.hour)}:${pad(date.minute)}:${pad(date.second)}.${pad(date.millisecond, 3)}`;
}
function instantResults(instant, zone, unit) {
const timeZone = validateTimeZone(zone);
const local = instant.toZonedDateTimeISO(timeZone);
yearRange(local.year);
return [
{ label: `Timestamp — ${unit.toLowerCase()}`, value: instantToTimestamp(instant, unit) },
{ label: 'UTC — ISO com Z', value: instant.toString({ fractionalSecondDigits: 3 }) },
{ label: `Local — ${timeZone} (offset ${local.offset})`, value: `${localText(local.toPlainDateTime())} ${local.offset} [${timeZone}]` },
];
}
function convertDateTool(slug, values) {
const input = (values.input ?? '').trim();
const zone = values.timezone ?? '';
const unit = values.unit ?? 'Segundos';
if (slug === 'timestamp-data' || slug === 'unix-time') {
let instant;
if (values.direction === 'Timestamp → Data')
instant = timestampToInstant(input, unit);
else if (values.direction === 'Data → Timestamp')
instant = /(?:Z|[+-]\d{2}:\d{2}(?::\d{2})?)$/.test(input) ? parseIsoInstant(input) : localToInstant(input, zone);
else
throw new Error('Selecione uma direção válida.');
return instantResults(instant, zone, unit);
}
if (slug === 'utc-local') {
let instant;
if (values.direction === 'UTC → Local') {
if (!input.endsWith('Z'))
throw new Error('UTC exige ISO explícito com Z: YYYY-MM-DDTHH:mm:ss[.SSS]Z.');
instant = parseIsoInstant(input);
}
else if (values.direction === 'Local → UTC')
instant = localToInstant(input, zone);
else
throw new Error('Selecione uma direção válida.');
return instantResults(instant, zone, 'Milissegundos').slice(1);
}
if (slug === 'iso-data-br') {
const toBr = values.direction === 'ISO → Data BR';
if (!toBr && values.direction !== 'Data BR → ISO')
throw new Error('Selecione uma direção válida.');
if ((toBr ? /^\d{4}-\d{2}-\d{2}$/ : /^\d{2}\/\d{2}\/\d{4}$/).test(input)) {
const date = plain(input, !toBr, true);
return [{ label: 'Data de calendário — sem fuso', value: toBr ? `${pad(date.day)}/${pad(date.month)}/${pad(date.year, 4)}` : date.toPlainDate().toString() }];
}
const instant = toBr ? parseIsoInstant(input) : localToInstant(input, zone, true);
const results = instantResults(instant, zone, 'Milissegundos').slice(1);
if (toBr)
results.unshift({ label: `Data/hora BR — ${validateTimeZone(zone)}`, value: localText(instant.toZonedDateTimeISO(zone.trim()).toPlainDateTime(), true) });
return results;
}
throw new Error('Conversor de datas desconhecido.');
}
return convertDateTool('iso-data-br', values);
}
import re
from datetime import datetime, timedelta, timezone
from zoneinfo import ZoneInfo
def executar(values=None):
values = {'direction': 'ISO → Data BR', 'input': '2024-02-29', 'timezone': 'America/Sao_Paulo'} if values is None else values
slug = 'iso-data-br'
def zone(value):
value = value.strip()
if not value or value.startswith(("+", "-")): raise ValueError("Informe um fuso IANA válido.")
try: return ZoneInfo(value)
except Exception as error: raise ValueError("Informe um fuso IANA válido.") from error
def plain(text, br=False, date_only=False):
pattern = r"([0-9]{2})/([0-9]{2})/([0-9]{4})" if br else r"([0-9]{4})-([0-9]{2})-([0-9]{2})"
match = re.fullmatch(pattern + ("" if date_only else (" " if br else "[ T]") + r"([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,3}))?"), text)
if not match: raise ValueError("Use DD/MM/YYYY" if br else "Use YYYY-MM-DD, com HH:mm:ss[.SSS] para data/hora.")
first, month, third = map(int, match.groups()[:3])
year, day = (third, first) if br else (first, third)
parts = [0,0,0,0] if date_only else [int(match[4]), int(match[5]), int(match[6]), int((match[7] or "").ljust(3, "0") or "0")*1000]
try: return datetime(year, month, day, *parts)
except ValueError as error: raise ValueError("Data ou horário impossível.") from error
def iso(text):
match = re.fullmatch(r"([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?)(Z|[+-][0-9]{2}:[0-9]{2}(?::[0-9]{2})?)", text.strip())
if not match: raise ValueError("Use ISO com Z ou offset explícito ±HH:mm[:ss], até milissegundos.")
local = plain(match[1])
offset = 0
if match[2] != "Z":
values = list(map(int, match[2][1:].split(":")))
if values[0] > 23 or values[1] > 59 or (len(values) == 3 and values[2] > 59): raise ValueError("Offset inválido.")
offset = (values[0]*3600 + values[1]*60 + (values[2] if len(values) == 3 else 0)) * (-1 if match[2][0] == "-" else 1)
try: return (local - timedelta(seconds=offset)).replace(tzinfo=timezone.utc)
except OverflowError as error: raise ValueError("Intervalo suportado: anos 0001 a 9999.") from error
def local_instant(text, selected, br=False):
local, tz = plain(text.strip(), br), zone(selected)
candidates = set()
for fold in (0,1):
try:
instant = local.replace(tzinfo=tz, fold=fold).astimezone(timezone.utc)
if instant.astimezone(tz).replace(tzinfo=None) == local: candidates.add(instant)
except (ValueError, OverflowError): pass
if len(candidates) != 1: raise ValueError("Horário local ambíguo (ocorre duas vezes)." if candidates else "Horário local inexistente ou fora do intervalo 0001–9999.")
return next(iter(candidates))
def utc_text(instant):
return f"{instant.year:04d}-{instant.month:02d}-{instant.day:02d}T{instant.hour:02d}:{instant.minute:02d}:{instant.second:02d}.{instant.microsecond//1000:03d}Z"
def offset_text(local):
seconds = int(local.utcoffset().total_seconds())
sign = "-" if seconds < 0 else "+"
hours, rest = divmod(abs(seconds), 3600)
minutes, seconds = divmod(rest, 60)
return f"{sign}{hours:02d}:{minutes:02d}" + (f":{seconds:02d}" if seconds else "")
def local_text(local, br=False):
day = f"{local.day:02d}/{local.month:02d}/{local.year:04d}" if br else f"{local.year:04d}-{local.month:02d}-{local.day:02d}"
return f"{day} {local.hour:02d}:{local.minute:02d}:{local.second:02d}.{local.microsecond//1000:03d}"
def timestamp(instant, unit):
if unit not in ("Segundos", "Milissegundos"): raise ValueError("Selecione segundos ou milissegundos.")
delta = instant - datetime(1970,1,1,tzinfo=timezone.utc)
ms = delta.days*86400000 + delta.seconds*1000 + delta.microseconds//1000
if unit == "Milissegundos": return str(ms)
whole, fraction = divmod(abs(ms),1000)
return ("-" if ms < 0 else "") + str(whole) + (f".{fraction:03d}" if fraction else "")
def from_timestamp(text, unit):
if unit not in ("Segundos", "Milissegundos"): raise ValueError("Selecione segundos ou milissegundos.")
match = re.fullmatch(r"([+-]?)([0-9]+)" + (r"(?:\.([0-9]{1,3}))?" if unit == "Segundos" else ""), text.strip())
if len(text) > 100 or not match: raise ValueError("Timestamp inválido: segundos até três casas; milissegundos inteiros.")
ms = int(match[2]) * (1000 if unit == "Segundos" else 1)
if unit == "Segundos": ms += int((match[3] or "").ljust(3, "0") or "0")
if match[1] == "-": ms = -ms
if not -62135596800000 <= ms <= 253402300799999: raise ValueError("Intervalo suportado: anos 0001 a 9999.")
return datetime(1970,1,1,tzinfo=timezone.utc) + timedelta(milliseconds=ms)
def results(instant, selected, unit):
tz = zone(selected)
try: local = instant.astimezone(tz)
except (ValueError, OverflowError) as error: raise ValueError("Intervalo suportado: anos 0001 a 9999 em UTC e local.") from error
offset = offset_text(local)
return [{"label":"Timestamp — " + unit.lower(), "value":timestamp(instant,unit)}, {"label":"UTC — ISO com Z", "value":utc_text(instant)}, {"label":f"Local — {selected.strip()} (offset {offset})", "value":f"{local_text(local)} {offset} [{selected.strip()}]"}]
input = values.get("input", "").strip()
selected = values.get("timezone", "")
unit = values.get("unit", "Segundos")
direction = values.get("direction", "")
if slug in ("timestamp-data", "unix-time"):
if direction == "Timestamp → Data": instant = from_timestamp(input, unit)
elif direction == "Data → Timestamp": instant = iso(input) if re.search(r"(Z|[+-][0-9]{2}:[0-9]{2}(?::[0-9]{2})?)$", input) else local_instant(input, selected)
else: raise ValueError("Selecione uma direção válida.")
return results(instant, selected, unit)
if slug == "utc-local":
if direction == "UTC → Local":
if not input.endswith("Z"): raise ValueError("UTC exige ISO explícito com Z.")
instant = iso(input)
elif direction == "Local → UTC": instant = local_instant(input, selected)
else: raise ValueError("Selecione uma direção válida.")
return results(instant, selected, "Milissegundos")[1:]
to_br = direction == "ISO → Data BR"
if not to_br and direction != "Data BR → ISO": raise ValueError("Selecione uma direção válida.")
if re.fullmatch(r"[0-9]{4}-[0-9]{2}-[0-9]{2}" if to_br else r"[0-9]{2}/[0-9]{2}/[0-9]{4}", input):
date = plain(input, not to_br, True)
value = f"{date.day:02d}/{date.month:02d}/{date.year:04d}" if to_br else f"{date.year:04d}-{date.month:02d}-{date.day:02d}"
return [{"label":"Data de calendário — sem fuso", "value":value}]
instant = iso(input) if to_br else local_instant(input, selected, True)
output = results(instant, selected, "Milissegundos")[1:]
if to_br: output.insert(0, {"label":"Data/hora BR — " + selected.strip(), "value":local_text(instant.astimezone(zone(selected)), True)})
return output
<?php
function executar($values = ['direction'=>'ISO → Data BR', 'input'=>'2024-02-29', 'timezone'=>'America/Sao_Paulo']) {
$slug = 'iso-data-br';
if (PHP_INT_SIZE < 8) throw new RuntimeException('Requer PHP de 64 bits.');
$zone = function ($value) {
$value = trim($value);
if (!in_array($value, DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC), true) && $value !== 'UTC') throw new InvalidArgumentException('Informe um fuso IANA válido.');
return new DateTimeZone($value);
};
$plain = function ($text, $br = false, $dateOnly = false) {
$datePattern = $br ? '([0-9]{2})/([0-9]{2})/([0-9]{4})' : '([0-9]{4})-([0-9]{2})-([0-9]{2})';
if (!preg_match('~^'.$datePattern.($dateOnly ? '' : ($br ? ' ' : '[ T]').'([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,3}))?').'$~D', $text, $m)) throw new InvalidArgumentException('Formato de data inválido; use datas explícitas e HH:mm:ss[.SSS].');
[$y,$month,$day] = $br ? [(int)$m[3],(int)$m[2],(int)$m[1]] : [(int)$m[1],(int)$m[2],(int)$m[3]];
$h = (int)($m[4] ?? 0); $minute = (int)($m[5] ?? 0); $second = (int)($m[6] ?? 0);
if ($y < 1 || $y > 9999 || !checkdate($month,$day,$y) || $h > 23 || $minute > 59 || $second > 59) throw new InvalidArgumentException('Data ou horário impossível.');
$normalized = sprintf('%04d-%02d-%02d %02d:%02d:%02d.%s',$y,$month,$day,$h,$minute,$second,str_pad($m[7] ?? '',3,'0'));
return DateTimeImmutable::createFromFormat('!Y-m-d H:i:s.v',$normalized,new DateTimeZone('UTC'));
};
$check = function ($instant) {
$year = (int)$instant->format('Y');
if ($year < 1 || $year > 9999) throw new InvalidArgumentException('Intervalo suportado: anos 0001 a 9999 em UTC e local.');
return $instant;
};
$fromMs = function ($ms) use ($check) {
$seconds = intdiv($ms,1000); $rest = $ms % 1000;
if ($rest < 0) { $seconds--; $rest += 1000; }
return $check((new DateTimeImmutable('@'.$seconds))->setTimezone(new DateTimeZone('UTC'))->modify('+'.$rest.' milliseconds'));
};
$iso = function ($text) use ($plain,$check) {
if (!preg_match('/^([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?)(Z|[+-][0-9]{2}:[0-9]{2}(?::[0-9]{2})?)$/D',trim($text),$m)) throw new InvalidArgumentException('Use ISO com Z ou offset explícito; até milissegundos.');
$local = $plain($m[1]); $offset = 0;
if ($m[2] !== 'Z') {
$parts = array_map('intval',explode(':',substr($m[2],1)));
if ($parts[0] > 23 || $parts[1] > 59 || ($parts[2] ?? 0) > 59) throw new InvalidArgumentException('Offset inválido.');
$offset = ($parts[0]*3600 + $parts[1]*60 + ($parts[2] ?? 0))*($m[2][0] === '-' ? -1 : 1);
}
return $check($local->modify(sprintf('%+d seconds',-$offset)));
};
$localInstant = function ($text,$selected,$br = false) use ($plain,$zone,$check) {
$local = $plain(trim($text),$br); $tz = $zone($selected); $wall = $local->getTimestamp();
$offsets = [];
foreach ($tz->getTransitions($wall-172800,$wall+172800) ?: [] as $transition) $offsets[$transition['offset']] = true;
$candidates = [];
foreach (array_keys($offsets) as $offset) {
$candidate = $local->modify(sprintf('%+d seconds',-$offset));
if ($candidate->setTimezone($tz)->format('Y-m-d H:i:s.v') === $local->format('Y-m-d H:i:s.v')) $candidates[$candidate->format('U.v')] = $candidate;
}
if (count($candidates) !== 1) throw new InvalidArgumentException($candidates ? 'Horário local ambíguo (ocorre duas vezes).' : 'Horário local inexistente.');
return $check(array_values($candidates)[0]);
};
$utcText = fn($instant) => $instant->format('Y-m-d\TH:i:s.v\Z');
$offsetText = function ($local) {
$offset = $local->getOffset(); $rest = abs($offset);
return sprintf('%s%02d:%02d',$offset < 0 ? '-' : '+',intdiv($rest,3600),intdiv($rest % 3600,60)).($rest % 60 ? sprintf(':%02d',$rest % 60) : '');
};
$timestamp = function ($instant,$unit) {
if (!in_array($unit,['Segundos','Milissegundos'],true)) throw new InvalidArgumentException('Selecione segundos ou milissegundos.');
$ms = $instant->getTimestamp()*1000 + (int)$instant->format('v');
if ($unit === 'Milissegundos') return (string)$ms;
return ($ms < 0 ? '-' : '').intdiv(abs($ms),1000).(abs($ms) % 1000 ? sprintf('.%03d',abs($ms) % 1000) : '');
};
$fromTimestamp = function ($text,$unit) use ($fromMs) {
if (!in_array($unit,['Segundos','Milissegundos'],true)) throw new InvalidArgumentException('Selecione segundos ou milissegundos.');
if (strlen($text) > 100 || !preg_match('/^([+-]?)([0-9]+)'.($unit === 'Segundos' ? '(?:\.([0-9]{1,3}))?' : '').'$/D',trim($text),$m)) throw new InvalidArgumentException('Timestamp inválido.');
$digits = ltrim($m[2],'0');
if (strlen($digits) > ($unit === 'Segundos' ? 12 : 15)) throw new InvalidArgumentException('Timestamp fora do intervalo.');
$ms = (int)$digits*($unit === 'Segundos' ? 1000 : 1) + ($unit === 'Segundos' ? (int)str_pad($m[3] ?? '',3,'0') : 0);
if ($m[1] === '-') $ms = -$ms;
if ($ms < -62135596800000 || $ms > 253402300799999) throw new InvalidArgumentException('Timestamp fora do intervalo.');
return $fromMs($ms);
};
$results = function ($instant,$selected,$unit) use ($zone,$check,$offsetText,$timestamp,$utcText) {
$local = $check($instant->setTimezone($zone($selected))); $offset = $offsetText($local); $selected = trim($selected);
return [['label'=>'Timestamp — '.strtolower($unit),'value'=>$timestamp($instant,$unit)],['label'=>'UTC — ISO com Z','value'=>$utcText($instant)],['label'=>'Local — '.$selected.' (offset '.$offset.')','value'=>$local->format('Y-m-d H:i:s.v').' '.$offset.' ['.$selected.']']];
};
$input = trim($values['input'] ?? ''); $selected = $values['timezone'] ?? '';
$unit = $values['unit'] ?? 'Segundos'; $direction = $values['direction'] ?? '';
if ($slug === 'timestamp-data' || $slug === 'unix-time') {
if ($direction === 'Timestamp → Data') $instant = $fromTimestamp($input,$unit);
elseif ($direction === 'Data → Timestamp') $instant = preg_match('/(Z|[+-][0-9]{2}:[0-9]{2}(?::[0-9]{2})?)$/D',$input) ? $iso($input) : $localInstant($input,$selected);
else throw new InvalidArgumentException('Direção inválida.');
return $results($instant,$selected,$unit);
}
if ($slug === 'utc-local') {
if ($direction === 'UTC → Local') {
if (!str_ends_with($input,'Z')) throw new InvalidArgumentException('UTC exige ISO com Z.');
$instant = $iso($input);
} elseif ($direction === 'Local → UTC') $instant = $localInstant($input,$selected);
else throw new InvalidArgumentException('Direção inválida.');
return array_slice($results($instant,$selected,'Milissegundos'),1);
}
$toBr = $direction === 'ISO → Data BR';
if (!$toBr && $direction !== 'Data BR → ISO') throw new InvalidArgumentException('Direção inválida.');
if (preg_match($toBr ? '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/D' : '/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/D',$input)) {
$date = $plain($input,!$toBr,true);
return [['label'=>'Data de calendário — sem fuso','value'=>$date->format($toBr ? 'd/m/Y' : 'Y-m-d')]];
}
$instant = $toBr ? $iso($input) : $localInstant($input,$selected,true);
$output = array_slice($results($instant,$selected,'Milissegundos'),1);
if ($toBr) array_unshift($output,['label'=>'Data/hora BR — '.trim($selected),'value'=>$instant->setTimezone($zone($selected))->format('d/m/Y H:i:s.v')]);
return $output;
}