DateTime? dateTimeToTime(String? date) { if (date == null) { return getCurrentTimestamp; } // retrun date to timestap DateTime? timestamp = DateTime.tryParse(date); return timestamp; }