This topic is locked

Another issue with ViewControl.Format (custom formatting)

10/1/2019 9:26:54 AM
ASPRunner.NET General questions
Pete K author

Should ViewControl.Format work when selecting "Custom" and inserting custom code in the View as tab? If so, I have uncovered another bug in this implementation.
I have two time fields. The standard Time format doesn't work for me because I don't want to display seconds. So I went with custom and used this code:



if (data["EndTime"] != null)

{

value = String.Format("{0:h:mm tt}", Convert.ToDateTime((string)data["EndTime"]));

}

else

{

value = "";

}


This works perfectly on all display pages, but when using ViewControl.Format to apply this formatting in an email from an update page, I get the raw time value in the email. This only applies to the custom formatting, not the built-in Time format. The other time Field, for which I selected the standard Time format as an A/B test, formats as expected in the email using ViewControl.Format:

  • Date: 10/18/2019
  • Time: 6:00:00 PM
  • End time: 19:00:00

I
i.NoLim 10/8/2019

I'm having a similar issue. I would like the time to be displayed in military time in the List and View page but its always show as AM or PM.