I have a table logout with columns
logout_id
logout_datetime values format like this(2011-09-08 11:09:09)
and i want to compare the logout_datetime with today date and time also….
for that i have done like this….
string dtStartString = DateTime.Today.ToString("yyyy-MM-dd");
string timeonly = DateTime.Now.ToShortTimeString();
string sql = @"select logout_id";
sql+= string.Format("where logout_datetime = '{0}'",dtStartString );
but it will compares only date in logoutdatetime ,its wrong i want to compare the time also
how can i do this..
would any one pls help on this…
Of course your code is only comparing the date because you are passing only
dtStartStringwhich does not have a time part.try to pass this: