Results 1 to 4 of 4

Thread: Discussion of Date and Time function

  1. #1
    Join Date
    Jan 2010
    Posts
    52

    Discussion of Date and Time function

    Hi All,
    Please I want to know how can I Calculate the duration between tow times for Example I've employee Start work 08:30: and end work 05:50.
    how can I get difference between two hours for this employee? How many type of calculations can be performed on date and time functions.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Calculation of Date and Time values

    If you want to calculate the time duration of two given times values. You can do it but before that your Time would be passed as an argument in the format defined means "5:50 PM" treated as "17:50". Using this method :

    Code:
    (to_date('17:50','HH24:MI') - To_date('08:30','HH24:MI'))*24
    Calculated value would be in hour.

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Representation of date value in proper format

    Normally, If you are working on oracle and accessing the date values from database. It follow some rules to insert the value in a proper format and if you goes beyond that format,Oracle restrict you to insert the value. In the case of accessing,there are some defined format used.

    You can represent it your own way,suppose you want to access the current date in time stamp format :

    Code:
    SQL>SELECT TO_CHAR(SYSDATE, 'DD-MON-YYYY HH:MI:SS') FROM dual;

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Calculation of month values

    Use of MONTHS_BETWEEN Function

    This function is used to calculate the duration of month between two dates.This function takes two arguments and return number of month duration.

    The syntax :

    Code:
    MONTHS_BETWEEN(<latest_date>, <earliest_date>)
    And implementation of syntax would be as follows:

    Code:
    SQL> SELECT MONTHS_BETWEEN(SYSDATE+365, SYSDATE-365) FROM dual;

Similar Threads

  1. Replies: 2
    Last Post: 29-11-2011, 09:29 AM
  2. Replies: 8
    Last Post: 19-10-2011, 05:08 AM
  3. DLC Discussion for Spider-Man: Edge of Time
    By Kaesini in forum Video Games
    Replies: 2
    Last Post: 16-10-2011, 10:23 PM
  4. MySQL date & time function.
    By Amaresh in forum Software Development
    Replies: 2
    Last Post: 19-06-2009, 02:49 PM
  5. Replies: 2
    Last Post: 10-04-2009, 09:36 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,025,158.76633 seconds with 17 queries