在使用EF时,想要比较字符串类型的日期时,参考以下: SQL语句: 1 2 3 4 1)select * from TableName where StartTime > '2015-04-08' 2)select * from TableName where StartTime >= '2015-04-08' 3)select * from TableName where StartTime < '2015-04-08' 4)select * from TableName where
有一个字符串的时间,比如"2012-12-31 16:18:36" 与另一个时间做比较,如果前者比后者早,则返回true,否则返回false. 为此,我设计了一个方法. import java.util.*; import java.text.ParseException; import java.text.SimpleDateFormat; class Test { public boolean compare(String time1,String time2) throws Pa