dateTimeFromSapEpoch property
DateTime?
get
dateTimeFromSapEpoch
Implementation
DateTime? get dateTimeFromSapEpoch {
if (this?.isEmpty ?? true) {
return null;
}
DateTime? returnVal;
final RegExp exp = RegExp(r'(?<=\()\d+?(?=\))');
try {
final Iterable<Match> matches = exp.allMatches(this!);
if (matches.isNotEmpty) {
final matchedText = matches.elementAt(0).group(0)!;
final int millisecondsSinceEpoch = int.parse(matchedText);
returnVal = DateTime.fromMillisecondsSinceEpoch(
millisecondsSinceEpoch,
isUtc: true,
);
}
} catch (_) {
return null;
}
return returnVal;
}