View previous topic :: View next topic |
Author |
Message |
vani Beginner
Joined: 28 May 2003 Posts: 51 Topics: 30
|
Posted: Tue Oct 14, 2003 12:14 am Post subject: TIMESTAMP |
|
|
Hi,
I would like to know how to truncate the TIMESTAMP (i.e i want to remove microseconds part) and define it as a column for a table.
I tried using
DOJ TIMESTAMP CHAR(19) NOT NULL,
but this does not work.
Is there any alternative for this. |
|
Back to top |
|
 |
vani Beginner
Joined: 28 May 2003 Posts: 51 Topics: 30
|
Posted: Tue Oct 14, 2003 3:58 am Post subject: |
|
|
I want to retrieve date and time at a stretch but i don't want microseconds
This should produce a single column |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Oct 14, 2003 4:46 am Post subject: |
|
|
vani,
Try these
Code: |
SELECT CHAR(DATE(TIMESTAMP)) CONCAT
CHAR('-') CONCAT
CHAR(TIME(TIMESTAMP))
FROM TABLE
;
|
OR
Code: |
SELECT SUBSTR(CHAR(TIMESTAMP),1,19)
FROM TABLE
;
|
Both of these queries will produce the value with date and time seperated by a '-'
Hope this helps...
cheers
kolusu |
|
Back to top |
|
 |
|
|