c# - ObjectQuery, passing Time in Where clause -
how can construct clause of objectquery querying time part of datetime column? i've tried following it's not working. invalid exception on convert.
objectquery<item> _query = itementities.createquery<item>("item"); _query = _query.where("convert(varchar,it.start_time,114) > '{0}'", starttime.timeofday);
also, i'm using oracle database. tried to_char
instead of convert , still same error.
thanks.
you should able time portion date using to_char
, subsequently converting system type e.g.
to_date(to_char(it.start_time,'hh24:mi:ss'), 'hh24:mi:ss') dual
if objectquery
doesn't support to_char
try using extract
, build time manually e.g.
to_date(extract(hour it.start_time) || ':' || extract(minute it.start_time) || ':' || extract(second it.start_time) dual, 'hh24:mi:ss');
Comments
Post a Comment