Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6667481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:56:16+00:00 2026-05-26T02:56:16+00:00

The line of code DateTime d = DateTime.Today; results in 10/12/2011 12:00:00 AM .

  • 0

The line of code DateTime d = DateTime.Today; results in 10/12/2011 12:00:00 AM. How can I get only the date part.I need to ignore the time part when I compare two dates.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:56:17+00:00Added an answer on May 26, 2026 at 2:56 am

    DateTime is a DataType which is used to store both Date and Time. But it provides Properties to get the Date Part.

    You can get the Date part from Date Property.

    http://msdn.microsoft.com/en-us/library/system.datetime.date.aspx

    DateTime date1 = new DateTime(2008, 6, 1, 7, 47, 0);
    Console.WriteLine(date1.ToString());
    
    // Get date-only portion of date, without its time.
    DateTime dateOnly = date1.Date;
    // Display date using short date string.
    Console.WriteLine(dateOnly.ToString("d"));
    // Display date using 24-hour clock.
    Console.WriteLine(dateOnly.ToString("g"));
    Console.WriteLine(dateOnly.ToString("MM/dd/yyyy HH:mm"));   
    // The example displays the following output to the console:
    //       6/1/2008 7:47:00 AM
    //       6/1/2008
    //       6/1/2008 12:00 AM
    //       06/01/2008 00:00
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This line of code: DateTime dt = DateTime.ParseExact(time, hh:mm, CultureInfo.InvariantCulture); parses a time value
I have the following line of code: group p by new DateTime((p.DateTime.Value.Ticks / interval.Ticks)
i use this line of code : [self parseXMLFileAtURL:url]; And i get this error
I have this line of code: double seconds = new DateTime(2006,7,6,12,1,0,DateTimeKind.Local).Subtract(new DateTime(1970,1,1,0,0,0,DateTimeKind.Local).TotalSeconds; This was
is there are better way to structure this line of code, as you can
I have this code: DateTime d = DateTime.Today; long l = d.ToBinary(); object o
this is my basic date-time structure: primary key(datetime) key auot_id date_time user_id 1 2010-10-01
I need to get the newest files/directory on my FTP server (updated today), I've
In My Asp.net webpage I need to display today's date into one of the
I have the following line of code in existing implementation DateTime.TryParseExact( 15/11/2021 00:00:00, dd/MM/yyyy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.