Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

date

Posted on 2003-12-10
9
Medium Priority
?
352 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
[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
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 2

Accepted Solution

by:
rogaut1 earned 150 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

610 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