Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
@if (@Model.Value
<p> <time> @if (@Model.Value<DateTime>("handbuchgb") != DateTime.MinValue) { @(Model.Value<DateTime>("handbuchgb").ToString("dd.MM.yyyy")) } </time> </p>
you would normally use value != default(DateTime) for checks like that
value != default(DateTime)
also, your code outputs an empty time tag if the value is not set, and you also call a method multiple times...
@{ var handbuchgb = Model.Value<DateTime>("handbuchgb"); } <p> @if (handbuchgb!=default(DateTime)) { <time>@handbuchgb.ToString("dd.MM.yyyy")</time> } </p>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
if Model.Value datetime is null
you would normally use
value != default(DateTime)
for checks like thatalso, your code outputs an empty time tag if the value is not set, and you also call a method multiple times...
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.