这是我编写并继承自 hr.holidays 的程序 如果所选日期在当前日期之前,那么它应该提供错误消息。 代码 -
from datetime import date
if self.date_from <= date.today():
print 'You cannot select the previous date'
但它给出了错误 -
TypeError: can't compare datetime.date to bool
由于
答案 0 :(得分:4)
Hello Ujjwal Singh Baghel,
请尝试以下代码,
<?php
while($row=mysqli_fetch_assoc($rResultSet))
{
?>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['user_role'];?></td>
<td><?php echo $row['start_date'];?></td>
<td>
<form id='<?php echo $row['id'];?>' action='edituser.php' method='post'>
<input type="hidden" name="id" value="<?php echo $row['id'];?>">
<input type="hidden" name="type" value="edituser">
<a href="javascript: document.getElementById('<?php echo $row['id'];?>').submit();">Edit</a>|
</form>
</td>
</tr>
<?php
}
?>
OR
#!/usr/bin/python
import datetime
i = datetime.datetime.now()
print ("Current date & time = %s" % i)
if self.date_from <= str(i):
print 'You cannot select the previous date'
from datetime import date
if self.date_from <= str(date.today()):
print 'You cannot select the previous date'
外线:
您无法选择上一个日期
我希望我的回答很有帮助。 如果有任何疑问请征求意见。