Solved

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

Posted on 2012-03-10
1
487 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 250 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

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

914 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