如何使用 da.searchcursor select 小时和分钟 = 0 的行

How to select rows where hours and minutes = 0 using da.searchcursor

我试图从 arc.sde 数据库中的众多表中排除一些结果,我唯一可以使用的字段是日期字段。我已经研究了 Python2 网站并试图了解第 8.1 页中关于日期时间等的内容,但尚未实现我的目标。 (使用 Win 7、ArcGIS 10.2、Python 2.7.5 和混合 OS 环境)

下面的代码运行良好......

with arcpy.da.SearchCursor(fc, ['LASTEDIT_ON']) as cursor:
    for row in cursor:
            if row[0] <> None:
                    print str(row[0])

但我需要它来排除返回的行,其中 hours/minutes/seconds 都是 00:00:00。

2014-05-13 16:16:34
2014-09-26 11:45:15
2015-06-18 14:47:05
2015-02-03 10:38:50
2008-03-10 00:00:00
2007-06-06 00:00:00

我尝试在我的代码中添加小时和分钟,但我认为我完全走错了路。错误如下。

if row[0] <> None and datetime.hour <> 0:

Error Info:
'module' object has no attribute 'hour'

如果你的日期字段是一个真正的日期字段,而不是一个文本字段,下面的代码将打印出时分秒全为空的日期:

import arcpy
with arcpy.da.SearchCursor(fc, 'LASTEDIT_ON') as cursor:
    for row in cursor:
        if row[0].hour == 0:
            if row[0].minute == 0:
                if row[0].second == 0:
                    print row[0]