DateTime? toDateTimeFromFormat(String format) { if(isEmpty) return null; try { return DateFormat(format).parse(this); } catch (e) { return null; } }