Get current date in widget template
Hello,
I'm modifying the event widget template, but I have no idea how to get the current date (DateTime.Now()) to be compared with the EventEnd field. Is there a way to accomplish this?
<sf:Conditional If='<%# DateTime.Now() > (DateTime)Eval("EventEnd") %>' runat="server"> <Then> Event ends. </Then> <Else> Event is active. </Else></sf:Conditional>Please advise.
Thanks,
Brew
Hi,
Can you please try to use the below sample which works for me:
<sf:Conditional If='<%# DateTime.Now < (DateTime)Eval("EventEnd") %>' runat="server"><Then><%# Eval("Title")%>'s end date (<%# Eval("EventEnd") %>) is AFTER than Now </Then><Else><%# Eval("Title")%> 's end date (<%# Eval("EventEnd") %>) is BEFORE than Now</Else></sf:Conditional>It works. Thank you Dimitri.