Solved

Problem formatting a date

Posted on 2009-06-30
3
160 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

8 Experts available now in Live!

Get 1:1 Help Now