This is my code where i am trying to fetch the data from DataTable.
Here i want to filter based on only date without time or date with time.
It depends on suppose if want data to that particular date means all records of that date else with the time.
Scenario
a) 04/19/2022 12:00:00 pm--->with timings format(mm/dd/yyyy hh:mi:ss am)--
b) 04/19/2022 -->without time only date
In the above code which i posted SCHEDULE_START_TIME is the column which i want to compare to date and DateTime
var listImport = (from DataRow _ctx in dt.Rows
select new
{
SESSION_ID = _ctx["session_id"] == DBNull.Value ? "" : _ctx["session_id"].ToString(),
STUDENT_ID = _ctx["student_id"] == DBNull.Value ? "" : _ctx["student_id"].ToString(),
STUDENT_NAME = _ctx["student_name"] == DBNull.Value ? "" : _ctx["student_name"].ToString(),
Assigned_TUTOR_ID = _ctx["preferred_tutor_id"] == DBNull.Value ? "" : _ctx["preferred_tutor_id"].ToString(),
Assigned_TUTOR_NAME = _ctx["Assigned_TUTOR_NAME"] == DBNull.Value ? "" : _ctx["Assigned_TUTOR_NAME"].ToString(),
Assigned_TUTOR_USERNAME = _ctx["user_name"] == DBNull.Value ? "" : _ctx["user_name"].ToString(),
GRADE = _ctx["grade_name"] == DBNull.Value ? "" : _ctx["grade_name"].ToString(),
SUBJECT = _ctx["subject_name"] == DBNull.Value ? "" : _ctx["subject_name"].ToString(),
School = _ctx["school_name"] == DBNull.Value ? "" : _ctx["school_name"].ToString(),
District = _ctx["district_name"] == DBNull.Value ? "" : _ctx["district_name"].ToString(),
COURSE = _ctx["course_name"] == DBNull.Value ? "" : _ctx["course_name"].ToString(),
SCHOOL_LEVEL = _ctx["School_level"] == DBNull.Value ? "" : _ctx["School_level"].ToString(),
BUCKET_ID = _ctx["bucket_id"] == DBNull.Value ? "" : _ctx["bucket_id"].ToString(),
TITLE = _ctx["title"] == DBNull.Value ? "" : _ctx["title"].ToString(),
SCHEDULE_START_TIME = _ctx["scheduled_starttime"].ToString() == "" ? (Nullable<DateTime>)null : Convert.ToDateTime(_ctx["scheduled_starttime"].ToString()),
}).Distinct().ToList();
could you please help me in this as soon as possible?