Translate

Home > December 2021

December 2021

ASP.NET GridView TimeSpan 24 hour to AM PM

Thursday, December 2, 2021 Category : 0

 <asp:TemplateField HeaderText="IN_TIME">
                                            <ItemTemplate>
                                                <asp:Label ID="lblInTime" runat="server" Text='<%# new DateTime().Add(TimeSpan.Parse(Eval("IN_TIME").ToString())).ToString("hh:mm tt") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="OUT_TIME">
                                            <ItemTemplate>
                                                <asp:Label ID="lblOUTTime" runat="server" Text='<%# new DateTime().Add(TimeSpan.Parse(Eval("OUT_TIME").ToString())).ToString("hh:mm tt") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>

Powered by Blogger.