DateTime Formatting in repeater
        Posted  
        
            by Krishna
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Krishna
        
        
        
        Published on 2010-05-12T15:34:26Z
        Indexed on 
            2010/05/12
            15:44 UTC
        
        
        Read the original article
        Hit count: 213
        
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.
© Stack Overflow or respective owner