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
    Antony
  2. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 18 Jul 2013 Link to this post

    Hello,

    Please try this

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


    Thanks,
    A2H
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top