Solved

date

Posted on 2003-12-10
9
343 Views
Last Modified: 2010-04-16
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 ?????
0
Comment
Question by:andrew67
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 2

Accepted Solution

by:
rogaut1 earned 50 total points
ID: 9912553
Hi,

DateTime.Now.Date();



Hope this helps


Robert
0
 
LVL 3

Author Comment

by:andrew67
ID: 9912591
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
 
LVL 2

Expert Comment

by:rogaut1
ID: 9912687
Build a wrapper class around DateTime
0
 
LVL 3

Author Comment

by:andrew67
ID: 9912704
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 20

Expert Comment

by:TheAvenger
ID: 9913610
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
 
LVL 9

Expert Comment

by:msdixon
ID: 9914979
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
 
LVL 3

Author Comment

by:andrew67
ID: 10130093
string dt = DatTime.Now.ToString();
dt.Substring(0,10);
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 10131305
Why do you do it like this? What about my post?
0
 
LVL 10

Expert Comment

by:smegghead
ID: 10269917
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
what technologies offer Authentication over Web Services? 4 104
Programmatically signing Word macros 4 61
Problem to error 4 43
Angular - break the dataset in chunks? 7 39
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 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

16 Experts available now in Live!

Get 1:1 Help Now