REmove TimePart from datetime

3 posts, 0 answers
  1. bob thomash
    bob thomash avatar
    35 posts
    Member since:
    Oct 2009

    Posted 16 Sep 2010 Link to this post

     Hello Friends !

    I m working 2010 telerik controls in silverlight 4.0 .
    I m using RadDatePicker.When i select the date the value coming like "9/14/2010 12:00:00 AM " I want to remove the time part from datetime.i want value "9/14/2010" in DateTime format.(Not string format like ToShortDatetime())

    Bob thomash
  2. George
    George avatar
    1332 posts

    Posted 16 Sep 2010 Link to this post

    Hello Bob,

    SelectedValue property is type of DateTime? and it cannot return only the date part of the value, it returns the time as well. 

    I hope this helps. I will be glad to assist you further.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Michael
    Michael avatar
    1 posts
    Member since:
    Feb 2013

    Posted 13 Jun 2018 in reply to George Link to this post

    If we get the actual DateTime object behind the nullable DateTime we can then format it as we wish:

    if (RadDatePicker1.SelectedDate.HasValue)
        startdate = RadDatePicker1.SelectedDate.Value.ToString("dd/MM/yyyy");
Back to Top