On 24 Jun 2004 09:59:05 -0700,
ji*********@hotmail.com (JA) wrote:
I am trying to pull a time stamp out of a database,looks like this
2004-06-24 10:12:03 . Then I need to substring it so that I can take
a difference of 2 times.
You can find the difference between two timestamps with a select from
the database.
Something like elect t_start, t_end, time_format((t_start - t_end),
'%H:%M%S) from testtab;
But I can't recall how to convert the hours (1 hr = 100, not 60)
You can also select each part of the timestamp into its own slot:
mysql> select extract(year from t_start) ys, extract(year from t_end)
ye, extract(month from t_start) ms from testtab;
Long but it works.
+------+------+------+------+------+------+
| ys | ye | ms | me | ds | de |
+------+------+------+------+------|------|
| 2004 | 2004 | 1 | 2004 | 2004 | 1 |
+------+------+------+------+------+------+
--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one!
http://www.databasix.com
================================================== =========================