I'm developing a web app which is the transition from a previous desktop versión based in visual basic 6. I have to display times within a support ticket system of when the ticket first arrived,was first handled etc.
I'm running into certain problems when time formating since I seem to have to use several different methods to get what I want depending on the input and now I'm confused as to when I should use each.
For example, when using a system DateNow to get an answer in Hours, minutes and seconds this works fine:
Strings.Format(Date.Now, "HH:mm:ss")
But I have string values within the database, that are stored in a certain way and I cannot modify the database to have a timestamp field which I would prefer to store it, with the time, minutes and seconds scrunched up together as in where 13h,57mins,20secs ends in a string "135720". If I try the same
Dim info as string="135720"
Strings.Format(val(info),"HH:mm:ss)
The answer I get is the actual formating "HH:mm:ss", not the 13:57:20 I expected. But if I use a transformed VB6 function in .net:
Microsoft.VisualBasic.Format(Val(Info), "##:##:##")
it works just fine. I also have to use the Microsoft.VisualBasic.Format when trying to fix badly stored strings with partial times such as "1357" or just "135" to turn it into "13:57:00" or "13:50:00"using a case select based on the length of the string.
but I really don't want to be using old programming language in what is supposed to be a an updated app just because I don't finally understand how the new works and I have looked extensively into the documentation, but am none the wiser.
I did look within th comunity but didn't really find the answer either in such questions as: Is there a way to programmatically convert VB6 Formatting strings to .NET Formatting strings?
A regular expression to validate .NET time format
Time format of datetime field in .net
Any help finding the new way I should be doing this and why would be greatly apreciated.
Thank You