Claes
Tue Nov 09 01:55:00 CST 2004
Or simply use the standard datetime format string "G"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandarddatetimeformatstrings.asp
Then you won't annoy users whose regional settings are not US English :-)
/claes
""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in message
news:vTN6O8fxEHA.3436@cpmsftngxa10.phx.gbl...
> Hi Ram,
>
> Based on my understanding, you want to display customized string
> representation for datetime type column in datatable.
>
> Default, if we do not specify any format string for the datagrid, it will
> call each column's ToString() method to get the string representation of
> that datacolumn. So you will get only the year, month and date
> representation.
>
> If you wanted to display customized string for the datetime type, we may
> explicit set Format string for that column. This can be achieved through
> adding a DataGridTableStyle with DataGridTextBoxColumn into the DataGrid's
> TableStyles property. Just set DataGridTextBoxColumn's MappingName to that
> datetime type column and set customized Format string for
> DataGridTextBoxColumn.Format property.
>
> For example, to display "11/8/2004 4:14:37 PM" string for datetime column,
> we may use the format string below:
> MM/dd/yyyy hh:mm:ss tt
>
> It works well on my machine.
>
> For the details reference about the customize format string of datetime,
> please refer to:
> "Custom DateTime Format Strings"
>
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcustomdatetimeform
> atstrings.asp
>
> For example, please refer to:
> "Custom DateTime Format Strings Output Examples"
>
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcustomdatetimeform
> atstringsoutputexamples.asp
> ===============================================================
> Please apply my suggestion above and let me know if it helps resolve your
> problem.
>
> Thank you for your patience and cooperation. If you have any questions or
> concerns, please feel free to post it in the group. I am standing by to be
> of assistance.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>