Home » SQL & PL/SQL » SQL & PL/SQL » time problem
time problem [message #4351] Sun, 01 December 2002 23:39 Go to next message
waseem
Messages: 6
Registered: May 2001
Junior Member
hi
i stored the time in database field fromtime and totime.now how i get the difference between two time
in query when i run query
select fromtime-totime from timetable it give me .233 som thing.
any solution to this problm
Re: time problem [message #4354 is a reply to message #4351] Mon, 02 December 2002 00:27 Go to previous message
Deepa
Messages: 269
Registered: November 2000
Senior Member
if you do an ordinary subract on datetimes it will return the count of difference in no. of days.
I think you fromtime and totime falls on the same day and may be with difference in hours or minutes.That's why it gives a decimal answer

If you want the difference in hours give

select (fromtime-totime)*24 from timetable

If you want in minutes give
select (fromtime-totime)*24*60 from timetable
Previous Topic: latest versions
Next Topic: SQL Query - Urgent
Goto Forum:
  


Current Time: Tue May 14 21:36:50 CDT 2024