Solved

Problem formatting a date

Posted on 2009-06-30
3
161 Views
Last Modified: 2013-11-07
Hi

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
0
Comment
Question by:andieje
  • 2
3 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 24744334
to test your field, you can use:

String.Format("{0}: {1}", groupDataRow("StartDate").GetType(), groupDataRow("StartDate"))
0
 

Author Comment

by:andieje
ID: 24744903
Hi
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.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 24745699
>>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?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
A short film showing how OnPage and Connectwise integration works.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now