I have time stored in Db as 800,1600 format in separate column. I want to add colon in time before giving it to UI. Currently I am calculating the size and zero if size is three and using insert to add colon after 2 characters.
Use below code
string time = "800"; string s1= DateTime.ParseExact(time.PadLeft(4, '0') , "HHmm", CultureInfo.InvariantCulture).ToString("HH:mm");