1

I need to show inside a repeater the remaining time for a sale object to end, which has DateTime ends property.

Based on https://stackoverflow.com/a/4386305/8383866 I tried to make it work but I'm getting:

) expected.

But I'm sure there is no parenthesis missing.

Ends in: <%#string.Format("{0:hh\\:mm\\:ss}", (TimeSpan)(DateTime.Now - (DateTime)Eval("finaliza")));%>
Barri
  • 23
  • 4

1 Answers1

0

I think you should convert Eval("finaliza") to DateTime with the Convert.ToDateTime method.

Like this

<%#string.Format("{0:hh\\:mm\\:ss}", (TimeSpan)(DateTime.Now - Convert.ToDateTime(Eval("finaliza"))));%>
Anders Revsgaard
  • 2,619
  • 1
  • 6
  • 23
  • Thanks but same message error shown, I think I'm going to add that TimeSpan on the object itself and then simply bind it on the repeater. – Barri Nov 26 '18 at 14:02