Hello Kentico Team,
I am attempting to turn military time into standard 12 hour time.
My idea was to check if the number in the hours case is greater than 12, and if so to subtract twelve from that number and add a "pm" at the end.
So I attempted to write the following: take the time field from the XML, convert it to a string, split it on the colon and keep the first half, convert that to an integer and check if it is larger than the number 12.
<%# If((Eval("DMEETING_TIME_START").ToString().Split((":")[0]).ToInt() > 12), ""+(Eval("DMEETING_TIME_START").ToString().Split((":")[0]).ToInt() -12)+":"+Eval("DMEETING_TIME_START").ToString().Split((":")[1])+"pm", ""+Eval("DMEETING_TIME_START")+"am") %>
So far this hasn't worked.
'System.Array' does not contain a definition for 'ToInt' and no extension method 'ToInt' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)
I may very well be over complicating this whole idea. Can anyone tell me what I got wrong in the script above, or clue me in to an easier way to handle this conversion?
Thanks in advance for your help.
-mike