Milliseconds time format in My SQL

Posted on 2003-03-26
Medium Priority
Last Modified: 2008-02-01
Can any one help.
How do you configure a table field for milliseconds in MySQL?



I want to create a database that holds lap records for games.

Please help me.

Question by:PBUK
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 15

Expert Comment

ID: 8210832
you CAN'T

use a varchar field, they are asisgnation-compatible with TIMESTAMPS and DATE/TIME

LVL 15

Accepted Solution

VGR earned 200 total points
ID: 8210839
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
$loc2 = (double)substr (strrchr ($loc1, ' '), 1); // secondes entières
$loc3 = (double)substr ($loc1, 1,strpos($loc1,' ')); // fraction de seconde = 0.xxx
$loc2 = $loc2+$loc3;
//echo "time $loc1 -> $loc2<BR>";
return $loc2;

function TimerStart() {
  GLOBAL $TTime;
} // 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;
  $locTime=round(1000.0*$locTime,5); // millisecondes arrondies à la 5ème décimale
  if ($parDisp) echo "<BR><CENTER><font size=-2>page generated in $locTime milliseconds</font></CENTER>";
} // TimerStop Integer (ms) Function

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question