Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I remove the time from a date from the Database

Posted on 2012-03-10
1
Medium Priority
?
502 Views
Last Modified: 2012-03-12
Hi I've tried several things and all of them are still giving me the time as well as the date.  I need a UK date only and tried:

string dateN = String.Format("{0:d/M/yyyy}", catchDate);

This STILL gives me time.  What do I need to do to stop the time displaying?
0
Comment
Question by:Lorna70
1 Comment
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 37705420
If catchDate is a string , the format won't do nothing good.

First make sure that catchDate is a date by casting catchDate to a datetime. I haven't done C++ for 2 decades, but if I remember well this is the right syntax.

String.Format("{0:d/M/yyyy}", (datetime) catchDate);

Then, you have to be aware that / in s format requests the date separator, not a slash. On many computers that will generate a - instead of a /. If you want to be sure to get the slash, use a backslash in front of it:

String.Format("{0:d\/M\/yyyy}", (datetime) catchDate);
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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:…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

971 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