Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    53

    Unanswered: get 2 date's period

    hi guys can u teach me how to get the period of 2 date? example here,
    date1 date;
    date2 date;

    can i get the days, minutes and seconds of difference between the 2 dates?
    the date format is: DD-MM-YYYY HH24:MIS but i can change it if required.
    thanks

  2. #2
    Join Date
    Jan 2004
    Location
    US
    Posts
    6
    Hello,

    This is a solution which i found on da net.Hope this helps..

    1 SELECT TO_CHAR(date1,'MMDDYYYY:HH24:MIS') date1,
    2 TO_CHAR(date2,'MMDDYYYY:HH24:MIS') date2,
    3 trunc(86400*(date2-date1))-
    4 60*(trunc((86400*(date2-date1))/60)) seconds,
    5 trunc((86400*(date2-date1))/60)-
    6 60*(trunc(((86400*(date2-date1))/60)/60)) minutes,
    7 trunc(((86400*(date2-date1))/60)/60)-
    8 24*(trunc((((86400*(date2-date1))/60)/60)/24)) hours,
    9 trunc((((86400*(date2-date1))/60)/60)/24) days,
    10 trunc(((((86400*(date2-date1))/60)/60)/24)/7) weeks
    11* FROM date_table
    DATE1 DATE2 SECONDS MINUTES HOURS DAYS WEEKS
    ----------------- ----------------- ---------- ---------- ---------- ---------- ----------
    06202003:16:55:14 07082003:11:22:57 43 27 18 17 2
    06262003:11:16:36 07082003:11:22:57 21 6 0 12 1

    Cheers!!

  3. #3
    Join Date
    Nov 2003
    Posts
    53
    searched the web but couldnt find any help, wat can i say, thanks man!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •