0

I am working on an API (PHP) which provides me time in Minutes:Seconds:Milli-seconds format (01:21:91). I don't know how to save it in mysql. I also need to make some operations in that time. Please help me with this.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
gautamlakum
  • 11,815
  • 23
  • 67
  • 90

1 Answers1

2

Since you are not working with mySQL 5.6 or higher you have to split it into two columns. The one for the datetime (dttme) and the other one for the microsecond (mcrscnds)

CREATE TABLE microseconds (
  dttme datetime,
  mcrscnds int
);

INSERT INTO microseconds VALUES
  ('2014-05-15 09:22:37.456789', MICROSECOND('2014-05-15 09:22:37.456789'));
CodeFanatic
  • 11,434
  • 1
  • 20
  • 38