Solved

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get month and date in a format 4 35
Groupbox Control ? 2 19
Regarding swagger API 1 17
How to get a Powershell script to launch from Visual Studio 19 26
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:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

820 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