我正在开发MVC应用程序,我正在使用输入类型datetime-local格式[mm / dd / yyyy - : - - ],我想设置它的输入最大值不大于当前的当前日期和时间,但我的验证最大值日期时间格式和DateTime.Now并不多,并确实正确验证。并尝试了更多的字符串格式,它只验证日期聚会,而不是时间聚会。 这是我的控制器
<table class="table sol-compare-table">
<thead>
<tr>
<th>
<div>
<a class="sol-pdf-generator hover-gray-icon sol-share-icon" target="_blank" ng-href="#">
<i class="fa fa-file-pdf-o"></i>
Ladda ner som PDF
</a>
<a class="sol-share-facebook hover-gray-icon sol-share-icon" onclick="#">
<img src="#" alt="facebook">
</a>
<a class="sol-share-twitter hover-gray-icon sol-share-icon" onclick="#">
<img src="#" alt="twitter"><!--<i class="fa fa-twitter"></i>-->
</a>
<a class="sol-share-mail hover-gray-icon sol-share-icon" onclick="#">
<i class="glyphicon glyphicon-envelope"></i>
</a>
</div>
<h2 class="sol-compare-heading">Allmän Information<h2>
</th>
<th ng-repeat="unit in units" class="sol-compare-heading">
<div>
<a href="#/unitDetail/{{unit.Id}}">
<img class="detail-main-image" ng-if="getImageOfUnit(unit).Value.Id" ng-src="#"></img>
</a>
</div>
<a href="#"></a>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="#">
<td>Name</td>
<td ng-repeat="unit in units">
<span ng-if="unitAttr.Value != null">
<span print-attribute="#"></span>
</span>
<span ng-repeat="#" ng-if="unitAttr.Values">
#
</span>
<span ng-if="# == null && unitAttr.Values == null">
-
</span>
</td>
</tr>
</tbody>
</table>
和我的观看输入:
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd hh:mm tt}", ApplyFormatInEditMode = true)]
public DateTime AlarmEndDate { get; set; }
任何帮助?。
修改:
例如:将这样的日期时间转换为:7/22/2015 12:00 AM AM of SQL Server到7/22/2015 12:00 AM输入类型datetime-local