Avatar of zoomer777
zoomer777

asked on 

DateTime Format for Dynamic Text

Hi, I want to format the DATE and TIME fields pulled from an Access database within an ASPX page.  I figured out how to do this with a DATAGRID, but now I can't figure out how to format the display of DATETIME values that are displayed using DYNAMICTEXT within the page.

With a datagrid, you can format the output with the "Dataformatstring" parameter:

<asp:BoundColumn DataField="DATE"
        HeaderText="DATE"
        ReadOnly="true"
        Visible="True"
        Dataformatstring="{0:d}"/>
<asp:BoundColumn DataField="TIME"
        HeaderText="TIME"
        ReadOnly="true"
        Visible="True"
        Dataformatstring="{0:HHmm}"/>
    </Columns>

How can I apply this formatting to DynamicText?

Code on the page looks like:

<table width="50%" border="1" bordercolor="#999999">
  <tr>
    <td width="40%" bgcolor="#FFCC00">FlightID</td>
    <td width="60%"><%# FlightDetails.FieldValue("FlightID", Container) %></td>
  </tr>
  <tr>
    <td bgcolor="#FFCC00">Date</td>
    <td><%# FlightDetails.FieldValue("DATE", Container)%>
      </td>
  </tr>
  <tr>
    <td bgcolor="#FFCC00">Time</td>
    <td><%# FlightDetails.FieldValue("TIME", Container) %></td>
  </tr>
</table>

Thanks for the help.
ASP.NET

Avatar of undefined
Last Comment
zoomer777

8/22/2022 - Mon