date

does any one know how i just get the date and not the date time stamp im using DateTime.Now but would love to use some like Date.Now ?????
LVL 3
andrew67Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rogaut1Commented:
Hi,

DateTime.Now.Date();



Hope this helps


Robert
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andrew67Author Commented:
gets rid of the time stamp but replaces it with 00:00:00 sorry but thanks any way oh and it doesnt need the () bit on
0
rogaut1Commented:
Build a wrapper class around DateTime
0
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

andrew67Author Commented:
you have lost me a bit there i think i will get the DateTime.Now time stamp assign that to a string then chop the relavent bit of the end
0
TheAvengerCommented:
Just use the DateTime.ToString(string format) method. I don't know what format you need exactly, but here are some examples:

DateTime dt = DateTime.Now;

dt.ToString ("dd.MM.yyyy") -> 10.12.2003
dt.ToString ("dd MMM yyyy") -> 10 Dec 2003
dt.ToString ("d") -> 12/10/2003
dt.ToString ("D") -> Wednesday, December 10, 2003
etc. etc.

For more examples and information have a look here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimeclasstostringtopic3.asp
0
msdixonCommented:
DateTime.Today


DateTime.Now includes the current time, whereas today is just the date (the hour, min, second & millisecond are set to zero with the Today property)
0
andrew67Author Commented:
string dt = DatTime.Now.ToString();
dt.Substring(0,10);
0
TheAvengerCommented:
Why do you do it like this? What about my post?
0
smeggheadCommented:
andrew67,

If you want just the date as a string, just use...

string dt=DateTime.Today.ToString("d");

This will return your date in the format specific to your user's machine.

Smg.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.