]> andersk Git - sql-web.git/blob - lib/display.lib.php
git-svn-id: svn://presbrey.mit.edu/sql/mitsql@40 a142d4bd-2cfb-0310-9673-cb33a7e74f58
[sql-web.git] / lib / display.lib.php
1 <?php
2
3 ## FORMATTING FUNCTIONS
4
5 function sprintSize($bytes, $float=2) {
6         if (is_null($bytes)) return null;
7         $kb = round($bytes / 1024, $float);
8         $mb = round($bytes / 1024 / 1024, $float);
9         $gb = round($bytes / 1024 / 1024 / 1024, $float);
10         
11         return ($bytes<1||$kb<1?$bytes.' B':($mb<1?$kb.' KB':($gb<1?$mb.' MB':$gb.' GB')));
12 }
13
14 function sprintTS($timestamp) { 
15         return substr($timestamp,0,4).
16                 '-'.substr($timestamp,4,2).
17                 '-'.substr($timestamp,6,2).
18                 ' '.substr($timestamp,8,2).
19                 ':'.substr($timestamp,10,2).
20                 ':'.substr($timestamp,12,2);
21 }
22
23 ?>
This page took 0.900701 seconds and 5 git commands to generate.