How compare only date with nhibernate and criteria
im trying to compare two dates like this
ICriteria criteria = base.DataStore.TransactionScope.NHibernateSession.CreateCriteria<CcCorte>();
criteria.Add(Restrictions.Ge("Start", init.Date));
But im just need to compare the dates without the time, i can take only date for server variable but dont know how to do it with the other开发者_Go百科.
Any ideas?
The following functions are available in HQL, maybe you could use them:
second(...), minute(...), hour(...), day(...), month(...), year(...)
So yea write your query using hql.
and if you think thats not helpful you can always write sql query and use sql servers DateTime functions like DateDiff etc and achieve the same...
Hope that helps.
精彩评论