Extracting time from date and adding it to another date.

Dear All,
The values of two fields in my table are as follows:
n_date n_time
12/7/2007 1/1/1970 5:50:23 PM
Both of these fields are of date data type.
How can i add the time from n_time to n_date so that n_date will reflect a date with time added?
The problem is that i want to sort on n_date and i am not getting result when two dates are having same values for n_date but different for n_time.
How can i create a new expression for sorting these values?
Thanks in advance.
Regards,
Sameer

Hi,
Check this.
with data as
( select to_date('12/7/2007','dd/mm/yyyy') as ndate, to_date('1/1/1970 5:50:23','dd/mm/yyyy hh24:mi:ss') ntime from dual)
select ndate + (ntime - trunc(ntime)) from data
Regards
RK

Similar Messages

  • Extract Time from date and Time and Need XLMOD Funtion to find the Difference between Two Time.

    X6 = "1/5/15 5:16 AM" & NOW ....................difference by Only Time
    not date
    X6 date and Time will be changing, Its not Constant
                Dim myDateTime As DateTime = X6
                Dim myDate As String = myDateTime.ToString("dd/MM/yy")
                Dim myTime As String = myDateTime.ToString("hh:mm tt")
                Dim myDateTime1 As DateTime = Now
                Dim myDate1 As String = myDateTime1.ToString("dd/MM/yy")
                Dim myTime1 As String = myDateTime1.ToString("hh:mm tt")
    Need to use this function to find the Difference between Two Time. due to 12:00 AM isuue
    Function XLMod(a, b)
        ' This replicates the Excel MOD function
        XLMod = a - b * Int(a / b)
    End Function
    Output Required
     dim dd  = XLMod(myTime - myTime1)
    Problem is myTime & myTime1 is String Need to convert them into Time, Later use XLMOD Funtion.

    Induhar,
    As an addendum to this, I thought I'd add this in also: If you have two valid DateTime objects you might consider using a class which I put together a few years ago
    shown on a page of my website here.
    To use it, just instantiate with two DateTime objects (order doesn't matter, it'll figure it out) and you'll then have access to the public properties. For this example, I'm just showing the .ToString method:
    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim date1 As DateTime = Now
    Dim date2 As DateTime = #1/1/1970 2:35:00 PM#
    Dim howOld As New Age(date1, date2)
    MessageBox.Show(howOld.ToString, "Age")
    Stop
    End Sub
    End Class
    I hope that helps, if not now then maybe at some point in the future. :)
    Still lost in code, just at a little higher level.
      Thanx frank, can use this in Future....

  • Problems While Extracting Hours From Date Field

    Hi Guys,
    Hope you are doing well.
    I am facing some problems while extracting hours from date field. Below is an example of my orders table:-
    select * from orders;
    Order_NO     Arrival Time               Product Name
    1          20-NOV-10 10:10:00 AM          Desktop
    2          21-NOV-10 17:26:34 PM          Laptop
    3          22-JAN-11 08:10:00 AM          Printer
    Earlier there was a requirement that daily how many orders are taking place in the order's table, In that I used to write a query
    arrival_time>=trunc((sysdate-1),'DD')
    and arrival_time<trunc((sysdate),'DD')
    The above query gives me yesterday how many orders have been taken place.
    Now I have new requirement to generate a report on every 4 hours how many orders will take place. For an example if current time is 8.00 AM IST then the query should fetch from 4.00 AM till 8 AM how many orders taken place. The report will run next at 12.00 PM IST which will give me order took place from 8.00 AM till 12.00 PM.
    The report will run at every 4 hours a day and generate report of orders taken place of last 4 hours. I have a scheduler which will run this query every hours, but how to make the query understand to fetch order details which arrived last 4 hours. I am not able to achieve this using trunc.
    Can you please assist me how to make this happen. I have checked "Extract" also but I am not satisfied.
    Please help.
    Thanks In Advance
    Arijit

    you may try something like
    with testdata as (
      select sysdate - level/24 t from dual
      connect by level <11
    select
      to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS') s
    , to_char(t, 'DD-MM-YYYY HH24:MI:SS') t from testdata
    where
    t >= trunc(sysdate, 'HH') - numtodsinterval(4, 'HOUR')
    S     T
    19-06-2012 16:08:21     19-06-2012 15:08:21
    19-06-2012 16:08:21     19-06-2012 14:08:21
    19-06-2012 16:08:21     19-06-2012 13:08:21
    19-06-2012 16:08:21     19-06-2012 12:08:21trunc ( ,'HH') truncates the minutes and seconds from the date.
    Extract hour works only on timestamps
    regards
    Edited by: chris227 on 19.06.2012 14:13

  • How do I convert time from hours and minutes to decimal time

    I am making a spread sheet a work for payroll. I need to make a formula that converts the time from hours and minutes to decimal time. Please help

    Hi Taryn,
    I can't see much from the photo, but I assume your formula is similar to the one I've used below:
    The same formula is used in F4 and F6, and both return the same result (shown in F4).
    F4 was left on "automatic" cell format, and the column widened to accomodate the repeating decimal to the point where Numbers would begin displaying zeros.
    F6 was formatted as shown in the Cell Inspector to show only two decimal places.
    Neither of these is an "exact" decimal, as it is not possible to use a decimal fraction to "exactly" represent 1/6 (or 10/60).
    The likely reasons for yours showing a whole number of hours is a difference between your formula and the one shown in the example here, or a difference in the number of decimal places set in the cell's format.
    Regards,
    Barry
    PS: To take a screen shot:
    Place the mouse pointer at the top left corner of the area you want to nclude in the shot.
    Press shift-command-4.
    Use the mouse to drag a selection rectangle contining the part of the screen you want to include.
    Release the mouse button. (You'll hear the sound of a camera shutter 'snapping' the picture.)
    The screen shot will be saved to your desktop with the name 'screen shot' followed by the date and time.
    The image may be posted to the discussion using the same steps you used to post the photo above.
    B.

  • How to extract keyframe from AVI and MPG

    Hi guy,
    I'm Marco and I'm using JMF; I need for an help because I don't know how to extract keyframes from AVI and MPG files.
    I'm using the code posted in this forum for extracting all frame in a video with the adding of an if expression that in the accessFrame method that I report below:
    void accessFrame(Buffer frame) {
    BufferToImage stopBuffer = new BufferToImage((VideoFormat) frame.getFormat());
    Image stopImage = stopBuffer.createImage(frame);
    try {
    BufferedImage outImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
    Graphics og = outImage.getGraphics();
    og.drawImage(stopImage, 0, 0, size.width, size.height, null);
    Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
    ImageWriter writer = (ImageWriter) writers.next();
    File f = new File(frame.getSequenceNumber() + ".jpg");
    {color:#ff0000}
    if ((frame.getFlags() & Buffer.FLAG_KEY_FRAME) != 0){{color}
    {color:#ff9900}
    ImageOutputStream ios = ImageIO.createImageOutputStream(f);
    writer.setOutput(ios);
    {color}
    {color:#ff9900}
    writer.write(outImage);
    ios.close();}
    } catch (IOException e) {{color}
    System.out.println("Error :" + e);
    So, I'm able to extract some keyframe, but i'm not sure it is the correct way and my dubt grows out of the fact that without the if expression highlighted in red, it seems that I have more keyframes (those ones with flag ==1040). Another problem is that it works only with AVI because MPG instead of 1040, they have alternate sequence of 32 and 1056.
    Cheers and thank u
    Marco

    my email-id is [email protected].. anyone plz send me the codings for extracting all the frames from a video..

  • SUBTRACT TIME FROM DATE & TIME

    Hi.
    I need FM which will SUBTRACT TIME from DATE & TIME.
    Example:
    Date = 05.05.2007
    Time = 05:00:00
    Time_subtract = 48:00:00
    Return of FM:
    Date = 03.05.2007
    Time = 05:00:00
    Do you know any FM?
    Thanks!

    Hi, Check these function mod's
    SD_DATETIME_DIFFERENCE
    HRCM_TIME_PERIOD_CALCULATE
    HR_ECM_GET_PERIOD_BETW_DATES
    After you execute them in SE37 give the required input and you will get a correct output.
    <b>REWARD IF USEFUL</b>
    thanks n regards
    Dinesh

  • Is there a way I can have my form calculate a total time from beginning and ending time?

    Is there a way I can have my form calculate a total time from beginning and ending time?

    Sorry, but Formscentral doesn't support either a timer function or any kind of calculation. You might be able to do this if created your form in PDF. For help with PDF form creation in Acrobat I suggest you repost your question to the Acrobat Forum.
    Andrew

  • Deleting yahoo acct. from instagram and adding gmail instead.

    I just changed my acct. from yahoo to gmail and I had already put yahoo as my email acct when signing up for instagram.  Could someone please help me with the process of deleting yahoo from instagram and adding gmail?  I have an iphone 5c.  Thanks so much.

    You really need to talk to someone at Instagram support. That's not an Apple service.

  • How to get time from Date

    I have a Column that is defined as "DATE".it also Contains Time.........
    I want to Get the Time only....so when i am using this
    to_date(var_date,'hh12:mi:ss PM'),it is giving me date also and when i am using this
    to_char(var_date,'hh12:mi:ss PM') then it is giving me all values similar to one of the top values in Column....
    Then i Used EXTRACT function as
    Select EXTRACT(HOUR FROM VAR_DATE).......
    THEN IT THRWOING ERROR.......INVALID EXTRACT FIELD FOR EXTRACT SOURCE........
    pLZ HELP HOW TO GET TIME...................................ONLY WITH AM AND PM......
    Thanks in Advance

    Hi,
    to_char function should give the result as expected.
    SQL> select to_char(sysdate, 'hh12:mi:ss PM') from dual ;
    TO_CHAR(SYS
    11:39:16 AM
    SQL> select to_char(sysdate, 'hh12:mi:ss AM') from dual ;
    TO_CHAR(SYS
    11:39:32 AM
    SQL> select to_char(sysdate,'hh:mi:ss') from dual ;
    TO_CHAR(
    11:40:04
    SQL> select to_char(sysdate,'hh:mi:ss am') from dual ;
    TO_CHAR(SYS
    11:40:18 am
    SQL> select to_char(sysdate,'hh:mi:ss pm') from dual ;
    TO_CHAR(SYS
    11:40:31 am
    Thanks,
    Siva

  • Extract Time in Date Datatype

    Hi Guys,
    I am running the below query:
    select to_char(sysdate,'hh24:mi:ss') from dual
    14:39:04
    select to_date(to_char(sysdate,'hh24:mi:ss'),'hh24:mi:ss') from dual
    01/07/2012 14:39:40Is is possibile to just get the time part in date datatype i.e anyhow by using the second query I should get only the time part instead of whole date and time.
    Cheers,
    Shaz

    Hi, Shaz,
    Sh**** wrote:
    Is is possibile to just get the time part in date datatype i.e anyhow by using the second query I should get only the time part instead of whole date and time.No. DATEs in Oracle always include year, month, day, hours, minutes and seconds. There's no way to have a DATE without all of them.
    Perhaps you want to store that data in an INTERVAL column, not a DATE.
    Depending on how you plan to use it, a NUMBER might work, too (e.g., the number of minutes past midnight) or a VARCHAR2, SUCH AS '09:53:32'.
    If you really needed to use a DATE for some reason, you could simply ignore the year, month and day, or always set them to some default value, such as January 1, 0001.
    What is the business problem you're trying to solve? If you explain what you need to do, then someone can help you find a good way to do it.

  • I created a new playlist and added tunes to another.  When I synched my ipod showed the new playlist heading but 0 songs, although it correctly received the new songs on the updated playlist.  Tried to synch several times with the same result.

    I created a new playlist and added some songs to another existing one.  When I synched with my PC, it loaded the new playlist heading but 0 songs, but did add the new songs to the existing playlist.  Repeated the process several times without success.

    This earlier post may help.
    https://discussions.apple.com/message/10859194#10859194
    For me,  (long winded way) I drag the playlist from the bottom tree to the iPod branch.
    Then select iPod.
    Click the music tab on the right window.
    click sync tick music
    go down to the playlist section and tick the playlist.
    Apply.
    Good Luck.

  • Applescript or workflow to extract text from PDF and rename PDF with the results

    Hi Everyone,
    I get supplied hundreds of PDFs which each contain a stock code, but the PDFs themselves are not named consistantly, or they are supplied as multi-page PDFs.
    What I need to do is name each PDF with the code which is in the text on the PDF.
    It would work like this in an ideal world:
    1. Split PDF into single pages
    2. Extract text from PDF
    3. Rename PDF using the extracted text
    I'm struggling with part 3!
    I can get a textfile with just the code (using a call to BBEDIT I'm extracting the code)
    I did think about using a variable for the name, but the rename functions doesn't let me use variables.

    Hello
    You may also try the following applescript script, which is a wrapper of rubycocoa script. It will ask you choose source pdf files and destination directory. Then it will scan text of each page of pdf files for the predefined pattern and save the page as new pdf file with the name as extracted by the pattern in the destination directory. Those pages which do not contain string matching the pattern are ignored. (Ignored pages, if any, are reported in the result of script.)
    Currently the regex pattern is set to:
    /HB-.._[0-9]{6}/
    which means HB- followed by two characters and _ and 6 digits.
    Minimally tested under 10.6.8.
    Hope this may help,
    H
    _main()
    on _main()
        script o
            property aa : choose file with prompt ("Choose pdf files.") of type {"com.adobe.pdf"} ¬
                default location (path to desktop) with multiple selections allowed
            set my aa's beginning to choose folder with prompt ("Choose destination folder.") ¬
                default location (path to desktop)
            set args to ""
            repeat with a in my aa
                set args to args & a's POSIX path's quoted form & space
            end repeat
            considering numeric strings
                if (system info)'s system version < "10.9" then
                    set ruby to "/usr/bin/ruby"
                else
                    set ruby to "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby"
                end if
            end considering
            do shell script ruby & " <<'EOF' - " & args & "
    require 'osx/cocoa'
    include OSX
    require_framework 'PDFKit'
    outdir = ARGV.shift.chomp('/')
    ARGV.select {|f| f =~ /\\.pdf$/i }.each do |f|
        url = NSURL.fileURLWithPath(f)
        doc = PDFDocument.alloc.initWithURL(url)
        path = doc.documentURL.path
        pcnt = doc.pageCount
        (0 .. (pcnt - 1)).each do |i|
            page = doc.pageAtIndex(i)
            page.string.to_s =~ /HB-.._[0-9]{6}/
            name = $&
            unless name
                puts \"no matching string in page #{i + 1} of #{path}\"
                next # ignore this page
            end
            doc1 = PDFDocument.alloc.initWithData(page.dataRepresentation) # doc for this page
            unless doc1.writeToFile(\"#{outdir}/#{name}.pdf\")
                puts \"failed to save page #{i + 1} of #{path}\"
            end
        end
    end
    EOF"
        end script
        tell o to run
    end _main

  • Extract Quarter from date cell

    I'm trying to extract Year Quarters from date column (A) with no luck.
    I've tried:
    =Int((Month(A1) + 2) / 3)
    but nothing happens. This formula works in Excel & Filemaker.
    Any ideas?

    Hello
    I'm really surprised because on my french version it works::
    =ENT((MOIS(A1)+2)/3)
    returns 4 with my birthday (31/12/1943)
    Yvan KOENIG (from FRANCE lundi 17 septembre 2007 20:20:21)

  • BPEL or OSB for reading data from db and then writing to another db

    Hi All,
    I have a requirement of reading the data from a table in one database and then writing into the table in another databas.I dont need any transformation on the data.
    I understand that i can do this by creating a BPEL process with DB adapters.
    Is there any better way of implementing this.I am new to OSB and If need to use OSB, then how can we do this in OSB and what are the advantages of using OSB over BPEL in implementing this.
    Thanks,
    ashok

    probably it would be much easier to develop everything in JDeveloper using DBAdapter.
    You can run it inside SOA Suite, but you don't even need BPEL, just use Mediator.
    Otherwise you can export all the JCA and WSDL and XSD paraphernalia from JDeveloper and import into OSB, it should run smoothly.
    How do you trigger the transfer? Polling the DB to look for new rows?

  • Extract year from date

    Hello,
    Iam using obiee 11g, would like to extract the year from date
    CAST(YEAR("ABC"."DATEADDED" ) as varchar(4))
    so used like this
    But i want like if the year is 2011 then only 11 i wants is there a direct function which does that.
    Thanks

    You can use the right function right(year, 2). Will return 11 if year is 2011

Maybe you are looking for

  • How can i use minutes and seconds in my job interval

    Sir, I want to use minutes and seconds in my job interval. suppose i want to run my job on 1:15:10 AM what will be the syntax. my code is below. Declare jobno number; BEGIN DBMS_JOB.SUBMIT(jobno,'DEL_DEPT;',trunc(SYSDATE + 1) + (1/24),'trunc(SYSDATE

  • External drive stuck in limbo - no errors, data intact, still won't mount?

    Background story: -I had an external enclosure with two drives (one Hitachi, one WD, both SATA) running seperately inside as storage. Things were good. One day something went wrong, because I turned it on and weird clicking could be heard and the dri

  • Column Validation

    In my form the requester is asked a choice and required to give a "yes" or "no" answer. I need to know if I can set a validation that would require the requester to attach a file when "yes" is selected. I am not using info path or designer for this f

  • Could not find i386-glibc21-linux.env.sh

    I need to install Oracle 816 for RedHat 7.1. But when I check file under /usr. There is no i386-glibc21-linux directory. Anyone know why?? Also, how do I install package?? (rpm??) I need to install compat-egcs, compat-glibc and compat-libs (6.2 compa

  • Copying Photo Albums from the iPhone to my new MacBook

    I put some photo albums on my iPhone from my old laptop. I didn't take the photos with the iPhone, but they are stored there. How do I copy them to my new MacBook? Can I perform a photo synch without erasing them?