Link to home
Start Free TrialLog in
Avatar of andrew67
andrew67

asked on

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 ?????
ASKER CERTIFIED SOLUTION
Avatar of rogaut1
rogaut1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andrew67
andrew67

ASKER

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
Build a wrapper class around DateTime
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
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
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)
string dt = DatTime.Now.ToString();
dt.Substring(0,10);
Why do you do it like this? What about my post?
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.