using System; namespace CarParkValidationAPI.Helpers; public class Helper { public static string DateToStr(DateTime? date) { string result = ""; if (date != null) result = date?.ToString("yyyy-MM-dd"); return result; } public static DateTime StrToDate(string date) { DateTime result = DateTime.Today; if (DateTime.TryParse(date, out var dt)) { result = dt; } return result; } }