Was wondering if anyone has a moment to help, please? I need to report the uptime of each of our servers. I am aware that you can use “Uptime of Operating System,” and that does work. However, it returns the output as “nn days, hh:mm:ss.000”. To make this Excel palatable, I need to have the output as DD:HH:MM:SS.000
I’m also aware of using the format inspector:
“(format “{0}{1}{2}{3}{4}{5}” + year of item 1 of it as string + month of item 1 of it as two digits as string + day_of_month of item 1 of it as two digits as string + two digit hour of item 0 of it + two digit minute of item 0 of it + two digit second of item 0 of it) of (time (universal time zone) of it, date (universal time zone) of it) of now”
…but have not figured out how to get that to work for the desired format. The caveat here, also, is that the DD (days) must also be zero padded.
Any help would be greatly appreciated!
Thank you so much!
Exactly why I need a zero-padded value for uptime in number of days. I confirm that BigFix returns values greater than 99 days. The issue is that, when I generate a CSV of this data, uptime of it is formatted as “1 Days, 10 Days, 101 Days” etc. So when you sort in Excel, it’s listed as 1, 10, 100, etc.
By zero padding number of days to 001, 010, 100, you get the correct sort order for number of days.
I haven’t tested this very much, but if the end goal is to be able to convert the data type to a ‘Time’ type in Excel, something like the following might work:
(uptime of operating system) / (1 * second) / 86400 as floating point
Maybe one possible option using somewhat crude string manipulations which I believe caters for 0 days as well as 1 day up to 999 days (maybe someone else has a more glamorous/creative method)
Q: ((last 3 of ("000" & ((it / (1 * day)) as string))) & ":" & ((following text of last "," of ("," & (it as string))) as trimmed string)) of (uptime of operating system)
A: 006:15:39:46.515
T: 0.242 ms
I: singular string
If I subtract 6 days from my uptime to give an uptime < 1 day it still gives the correctly formatted result
Q: ((last 3 of ("000" & ((it / (1 * day)) as string))) & ":" & ((following text of last "," of ("," & (it as string))) as trimmed string)) of (uptime of operating system - 6 * day)
A: 000:15:39:46.390
T: 0.122 ms
I: singular string