Thread: Getting only Date by using DateTime ?

  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, 08:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03: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, 08:35 AM