[SOLVED] Â Formatting time field on View as tab |
4/20/2016 8:33:36 AM |
ASPRunner.NET General questions | |
![]() I'm having much difficulty with something that should be quite simple. I have a field (StartTime) that is of data type Time in the SQL database. I'm trying to get it display as a short time ("h:mm tt"). If I just select "Time" from the pre-defined formatting options on the view as tab, it displays as 24 hour time and also includes seconds. (By the way, it would be most helpful if ASPR.net supplied some help with formatting dates and times with clickable properties on this tab.) String.Format("{0:h:mm tt}", Convert.ToDateTime((string)data["StartTime"]))
|
|
![]() |
Pete K author 4/20/2016 |
Man, do I feel stupid. I had everything right.... except I left out the all-important "value = " value = String.Format("{0:h:mm tt}", Convert.ToDateTime("10/06/1961 8:35:00"))
|
T
|
Tim 4/20/2016 |
Hey Pete, |
![]() |
Pete K author 4/20/2016 |
Thanks, Tim. That's another great approach. Seems there's always more than one way to solve a problem. |