Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem formatting a date

Posted on 2009-06-30
3
Medium Priority
?
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

636 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