Solved

Problem formatting a date

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
parsing JSON help 1 26
Iteration Help (Asp.net VB) 5 37
MailAddress in vb 4 36
Changes to XXX.exe.config file are not retrieved on restart. 3 49
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
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:…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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