time difference

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

time difference

Post by myasirm »

hi guys
i have two columns in one table in both time is diffent i need the differnce of time and date between that and store in third column how can i do this i have used that format 21/10/2009 01:17 and i am using oracle as back end database
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: time difference

Post by Mark Baker »

I can't understand the need to store the result in a new column it if you're already storing the two dates used for the calculation

But it's as simple as date1 - date2

If you have

Code: Select all

 
CREATE TABLE RCD_FILE_TREE
(
  FILE_ID              NUMBER                   NOT NULL,
  FILE_TYPE            VARCHAR2(16 BYTE)        NOT NULL,
  FILE_NAME            VARCHAR2(64 BYTE)        NOT NULL,
  FILE_PARENT_ID       NUMBER,
  CREATED_ON           DATE                     DEFAULT SYSDATE,
  LAST_UPDATED_ON      DATE
)
 
Then

Code: Select all

 
SELECT LAST_UPDATED_ON - CREATED_ON AS DAYS_INTERVAL
  FROM RCD_FILE_TREE
 WHERE FILE_ID = 1
 
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: time difference

Post by myasirm »

thx dear i resolved my query with ur help
Post Reply