DateTime Formatting in repeater
- by Krishna
Hi,
I am trying to format the date time (yyyy/MM/dd) in a repeater which is binded to an ObjectDataSource as shown
(THIS WORKS)
<%# ((MyType)Container.DataItem).CreateDateTime.ToString("yyyy/MM/dd")%
(THIS DOES`NT WORKS)
<%# String.Format("{0:yyyy/MM/dd}",((MyType)Container.DataItem).UpdateDateTime)%
I want to have both things working because sometimes the property UpdateDateTime is null, in such cases the second line of code handles smart.
Thank you for the help in advance.