A 1 Line Seconds To Minutes
This is a function to make seconds into minutes with just one line of code! It's completely commented and very easy to understand. I've seen some other one's that were like 20 or 30 linez long so i made this one. Very good for an mp3 player. I have more lines of comments than i do code :/
AI
Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Zdrojový kód
Function SecsToMins(Secs As Integer) If Secs < 60 Then SecsToMins = "00:" & Format(Secs, "00") Else SecsToMins = Format(Secs / 60, "00") & ":" & Format(Secs - Format(Secs / 60, "00") * 60, "00") 'if the seconds are less than 60 it will put a "00:" in front of it and the seconds formatted so if it was 6 seconds then it would be 06 'using format is pretty helpful 'if the seconds are 60 or are more than 60 it will 'divide the amount of seconds by 60 to get minutes 'then comes the harder to understand part(for some people) 'to get the seconds you have to format your seconds by 60 so there are no decimals. Then you multiple that by 60 and take that number away from the total seconds 'it took me awhile to figure out that i needed the format in the middle of finding the seconds. End Function
Původní komentáře (3)
Obnoveno z Wayback Machine