I have 2 different fields from a table and both have same format of timestamp.
and
How can I subtract two timestamp to get the duration in time.
now how to do it
7/18/2012 10:19:48 AM
and
7/18/2012 10:20:46 AM
How can I subtract two timestamp to get the duration in time.
now how to do it
SELECT (firstDateColumn - secondDateColumn) * 24 * 60 difference_in_minutes
FROM yourtable
If the dates are string then convert them first:SELECT (TO_DATE(firstDateColumn, 'dd/mm/yyyy HH:MI:SS AM') -
TO_DATE(secondDateColumn, 'dd/mm/yyyy HH:MI:SS AM')) *
24 * 60 difference_in_minutes
FROM yourtable
best regards
Yasser
No comments:
Post a Comment