visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Databases :: MySql :: Milliseconds time format in My SQL


By: PBUK U.S.A.  Date: 26/03/2003 00:00:00  English  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 English  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 English  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

EContact
browser fav
page generated in 319.191930 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page