Solved

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

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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 …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 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