View Single Post
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-14-2023 , 12:12   Re: Number Formatting
Reply With Quote #5

I'm using something in python that might be useful here:

PHP Code:
def convert_size(size_bytes):
   if 
size_bytes == 0:
       return 
"0B"
   
size_name = ("B""KB""MB""GB""TB""PB""EB""ZB""YB")
   
int(math.floor(math.log(size_bytes1024)))
   
math.pow(1024i)
   
round(size_bytes p2)
   return 
"%s%s" % (ssize_name[i]) 
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be