Databases :: MySql :: Milliseconds time format in My SQL |
|||
| By: PBUK |
Date: 26/03/2003 00:00:00 |
Points: 50 | Status: Answered Quality : Excellent |
|
Can any one help. How do you configure a table field for milliseconds in MySQL? eg. HH:MM:SS:AAA AAA=milliseconds I want to create a database that holds lap records for games. Please help me. PBUK. |
|||
| By: VGR | Date: 26/03/2003 01:58:00 | Type : Comment |
|
| you CAN'T use a varchar field, they are asisgnation-compatible with TIMESTAMPS and DATE/TIME <A HREF="http://www.mysql.com/doc/en/Date_and_time_functions.html">http://www.mysql.com/doc/en/Date_and_time_functions.html</A> |
|||
| By: VGR | Date: 26/03/2003 01:59:00 | Type : Answer |
|
| in the case this is useful to you, this computes delta times in milliseconds : <? //VGR14042001 Creation //VGR24112002 ADDed sécurité pour mode globDisc // // // ----------------------------- FORUM ----------------------------------- // function myTime() { // en secondes $loc1=microtime(); $loc2 = (double)substr (strrchr ($loc1, ' '), 1); // secondes entières $loc3 = (double)substr ($loc1, 1,strpos($loc1,' ')); // fraction de seconde = 0.xxx $loc2 = $loc2+$loc3; //test //echo "time $loc1 -> $loc2 "; // return $loc2; } function TimerStart() { GLOBAL $TTime; $TTime=myTime(); } // TimerStart Procedure function TimerStop($parDisp=FALSE) { // and display GLOBAL $TTime; $locTime=myTime()-$TTime; // en secondes //VGR14042001 BUGFIX // il y a un bug dans la fonction de base : la seconde n'est pas incrémentée correctement. if ($locTime<0) $locTime=1.0+$locTime; //EoFIX $locTime=round(1000.0*$locTime,5); // millisecondes arrondies à la 5ème décimale if ($parDisp) echo " <CENTER><font size=-2>page generated in $locTime milliseconds</font></CENTER>"; return($locTime); } // TimerStop Integer (ms) Function ?> |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








