locked
DateTimePicker shows no time, only date RRS feed

  • Question

  •  

    Hi all,

     

    I dragged a datetimepicker on my form, but it only shows date, not time. How to do that it's show time?

    Sunday, November 4, 2007 5:50 PM

Answers

  • Hi Rinaldo

     

    You can use DataTimePicker's Format and CustomFormat properties to change displayed string format.

     

    Yours Markku

    Sunday, November 4, 2007 6:32 PM
  • Hi Rinaldo

     

    string longDate = dateTimePicker1.Value.ToLongDateString();

    string longTime = dateTimePicker1.Value.ToLongTimeString();

     

    Yours Markku

    Tuesday, November 6, 2007 12:08 AM
  • Hi Ronaldo

     

    string dayOfWeek = dateTimePicker1.Value.DayOfWeek.ToString();

     

    Yours Markku

    Wednesday, November 7, 2007 11:43 AM

All replies

  • Hi Rinaldo

     

    You can use DataTimePicker's Format and CustomFormat properties to change displayed string format.

     

    Yours Markku

    Sunday, November 4, 2007 6:32 PM
  • Hi Markku,

     

    Do you know how to get the long format of the date from the DateTimePicker? like long time = DateTimePicker.Time; ? and the current system time.

     

    Sunday, November 4, 2007 7:51 PM
  • Hi Rinaldo

     

    string longDate = dateTimePicker1.Value.ToLongDateString();

    string longTime = dateTimePicker1.Value.ToLongTimeString();

     

    Yours Markku

    Tuesday, November 6, 2007 12:08 AM
  • And the weekday's, is ther any change tot get thos too?

     

    Thnx for year expanatiion

     

    Tuesday, November 6, 2007 11:40 PM
  • Hi Ronaldo

     

    string dayOfWeek = dateTimePicker1.Value.DayOfWeek.ToString();

     

    Yours Markku

    Wednesday, November 7, 2007 11:43 AM
  • Thankx you all for the clear explanation.

     

    Wednesday, November 7, 2007 1:20 PM
  • Thankx you all for the clear explanation.

     


    Firs you should select Format--> Short (İn visual Studio)
    after you should write the code at your database dateTimePicker1.Text (at "insert" operation)
    will Not use  dateTimePicker1.Value
    • Proposed as answer by AdelR5 Friday, October 12, 2012 2:02 PM
    Saturday, January 29, 2011 9:10 PM
  • thnx friend ur suggetion worked for me i was using .value u rectify by .text after some custom format .. thnx again ...
    Wednesday, June 1, 2011 4:25 PM
  • Thank you

    so much


    adelr5@yahoo.com

    Friday, October 12, 2012 2:02 PM