Problem formatting a date


I was wondering why the following don't work

String.Format("{0:d}", groupDataRow("StartDate"))
String.Format("{0:dd-MM-yyyy}", groupDataRow("StartDate"))

GroupDataRow is a datarowview. The startDate column in the underlying database is a calculated column from a mysql view which just returns the date part of a datetime column. I presume then that the datarowview is not classifying the calculated field as a date type because the above formats do work for columns that have type date. How can i find out what data type the data row view is assigning to StartDate?

many thanks
Who is Participating?
Jaime OlivaresConnect With a Mentor Software ArchitectCommented:
to test your field, you can use:

String.Format("{0}: {1}", groupDataRow("StartDate").GetType(), groupDataRow("StartDate"))
andiejeAuthor Commented:
I don't know if you are still around. GetType doesn't return a value for this column. Does that mean it's an untyped column? The other columns have a type.
Jaime OlivaresSoftware ArchitectCommented:
>>GetType doesn't return a value for this column
it should return something, could you post the returning string?
also, could you post your original query?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.