Getting only Date by using DateTime ?

This is a discussion on Getting only Date by using DateTime ? within the C# Programming forums, part of the General Programming Boards category; i want to get only the date by using DateTime, how can i do it?...

  1. #1
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71

    Getting only Date by using DateTime ?

    i want to get only the date by using DateTime, how can i do it?

  2. #2
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    i did it by writing like that
    Code:
    label6.Text = DateTime.Now.Date.ToString();
    but still at the end there are 00:00:00 is it normal?

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    You can specify what format it should be printed in:
    Code:
    ToString("yyyy-MM-dd")
    y/M/d obviously standing for year/month/day, and the amount means how many digits, like yyyy = 2009 and yy = 09. Note the capital 'M' for 'month', as 'm' means 'minute'.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Registered User Aga^^'s Avatar
    Join Date
    Aug 2008
    Posts
    71
    thanks magos

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advancing day by day until it matches a second date
    By nhubred in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2009, 09:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 04:25 PM
  3. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 05:23 PM
  4. CDate Class - handle date manipulation simply
    By LuckY in forum C++ Programming
    Replies: 5
    Last Post: 07-16-2003, 09:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21