Time format conversion issue.

2 posts, 0 answers
  1. Antony
    Antony avatar
    32 posts
    Member since:
    Feb 2013

    Posted 17 Jul 2013 Link to this post

    Hi guys

    I am trying to convert the selected time in radtimepicker to am/pm format using the following code.

    string start = RadTimePickerstartschedule.SelectedTime.ToString("hh:mm:tt");

    but I am getting an error that there is no ToString() that takes 1 argument.
    Actually the radtimepicker displays date in am/pm format but when I checked in C# code, its automatically converted to 24 clock format. How can I convert the time to am/pm format?

    Please help soon
  2. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 18 Jul 2013 Link to this post


    Please try this

    string selectedTimeValue = RadTimePicker1.SelectedTime.ToString();
    string value = Convert.ToDateTime(selectedTimeValue).ToString("hh:mm:ss tt", CultureInfo.InvariantCulture);

Back to Top