GetDate of resultset Ignoring the Time (hors min secs) component in DB2

Hello I have a DB2 in which has the date in the format 2007-01-24 09:25:21.680000.
I am trying to retrevie it using the
java.sql.Date start =rs.getDate("Give_time");
System.out.println("This is the Start Time Stamp" + startBuild.getTime());
Gives me the Timestamp of the "2007-01-24" completely ignoring the time "09:25:21" which is more important to me in this case.
How do I retreve the time in the date ?

If you mean getTimeWell actually no he meant getTimestamp but that doesn't seem to be your real issue.
There are three kinds of date/time objects in JDBC/SQL. One is a Date (that holds only the Date information), one is a Time (that holds only Time information) and last is a Timestamp (that holds both).
So if you want to get the time you need use getTimestamp or getDate methods. However as mentioned you also need to
- have a field that is actually storing this information
- actually be storing this field
So one of those two looks like in your case it isn't correct.

Similar Messages

  • LIKE Operator to ignore the time part of DATE type?

    Hi,
    is it allowed to use the LIKE operator on DATE Type to ignore the time-part in the DATE?
    Nothing found in the manual, but seems to me that it works.
    1. SELECT * FROM test_date WHERE tst_date LIKE to_date('01.01.2003 13:33:33','DD.MM.YYYY HH24:MI:SS') ;
    2. SELECT * FROM test_date WHERE tst_date LIKE to_date('01.01.2003','DD.MM.YYYY') ;
    3. SELECT * FROM test_date WHERE tst_date LIKE trunc(to_date('01.01.2003 00:00:00','DD.MM.YYYY HH24:MI:SS'));
    4. SELECT * FROM test_date WHERE to_date('01.01.2003 13:33:33','DD.MM.YYYY HH24:MI:SS') LIKE tst_date;
    5. SELECT * FROM test_date WHERE tst_date BETWEEN to_date('01.01.2003 00:00:00','DD.MM.YYYY HH24:MI:SS') AND to_date('01.01.2003 23:23:59','DD.MM.YYYY HH24:MI:SS');
    6. SELECT * FROM test_date WHERE tst_date >= TO_DATE('01.01.2003 00:00:00','DD.MM.YYYY HH24:MI:SS') AND tst_date < TO_DATE('01.01.2003')+1;
    7. SELECT * FROM test_date WHERE TRUNC(tst_date) = TRUNC(TO_DATE('01.01.2003 00:00:00','DD.MM.YYYY HH24:MI:SS'));
    Result for 1-7 is the same.
    What is the preferred Solution?
    Solution 5 is bad, because index on TST_DATE column could not be used.
    Solution 1 - 3 is the same using the LIKE operator.
    Any comments?
    Thanks, Markus
    GEMS IT

    Oh, sorry, LIKE-Operator solutions do also not use an Index :-(. Only 5. and 6.
    Sample-Script:
    CREATE TABLE TEST_DATE
    TST_DATE DATE
    CREATE INDEX MEDVIEW.TEST_DATE_IDX
    ON MEDVIEW.TEST_DATE(TST_DATE);
    INSERT INTO TEST_DATE ( TST_DATE ) VALUES (
    TO_Date( '01/01/2003 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO TEST_DATE ( TST_DATE ) VALUES (
    TO_Date( '01/01/2003 12:45:13 PM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO TEST_DATE ( TST_DATE ) VALUES (
    TO_Date( '01/01/2003 08:11:55 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO TEST_DATE ( TST_DATE ) VALUES (
    TO_Date( '01/01/2003 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO TEST_DATE ( TST_DATE ) VALUES (
    TO_Date( '01/01/2003 09:33:16 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO TEST_DATE ( TST_DATE ) VALUES (
    TO_Date( '01/02/2003 07:45:00 AM', 'MM/DD/YYYY HH:MI:SS AM'));
    INSERT INTO TEST_DATE ( TST_DATE ) VALUES (
    TO_Date( '01/02/2003 07:33:00 PM', 'MM/DD/YYYY HH:MI:SS AM'));
    COMMIT;

  • Decimal format time value to convert into time (hr:min:sec)value in a graph

    I need to develop a graph in WAD, in BW7. In the graph the value must be showed as HR:MIN:SEC, which I cannot get it right.
    The keyfigure value  carries the duration(hr:min:sec) in decimal format.  In the query, I use this keyfigure for calculation. To get the time broadcasted for a week range. I get the total duration (say 507835.000). Now I need to convert this value back to hr:min:sec. I use the below formulas to get the hr, min, sec.
    D = 507835
    Val1 = D/3600
    Val2 = Frac(val1)
    Val3 = Val2 * 60
    Val4 = frac(Val3) * 60
    Hr = Val1 – Val2
    Min =  Val3 – frac(Val3)
    Sec =  Val4
    In another formula in the query I add Hr + Min/100 + Sec/10000 to get hr.minsec format.
    When I do an average on count of weeks,  this doesn’t round off correctly.
    I tried to also use the Data function TIME() which when the time is > 24 hrs changes the value.
    Lets say if it is 39:00:00, it shows value as 15:00:00 instead of keeping the value 39:00:00.
    When I used this value in the graph it did not show the HR:MIN:SEC values in the value axis instead  it showed 0.0, 0.1,….1.0. Bcoz of this the graph is blank.
    Can anybody help me to resolve this problem.
    Thanks alot
    Anima

    I checked SU01 and didn't see anything there to customize...
    In my workstation, control panel / regional and languages settings / tab regional Options / customize; my time format is HH:mm:ss; the HH has to be in capital letter to display the time in 24 hour...
    but this is strange anyway... are you reporting with web frontend or excel?

  • ACCUM function ignores the time consolidation option

    Hi,
    We need to create YTD KPIs based on the Monthly KPIs.
    We are trying to use te ACCUM function to create the KPIs:
    calc KPI_ACC = ACCUM(KPI,yearly)
    but when the time consolidation method of the KPI is not SUM (e.g. LAST), the ACCUM function doesn't take this into account.
    Any ideas?
    Regards

    Again I'm doing this from memory. Control variables can be used in all these places.
    I tend to use the ASK command to present a menu and set the dates. A single selection from ASK can set many variables.
    Then I have a shell proc with command like
    set period Jan - &myvar
    calc var2 = average(var1) for &myvar
    in some cases this proc can be run as it stands. In other cases the control var won't resolve. In this case I then have a command that does something like
    copy pro myshellproc myexecuteproc resolve
    compile myexecuteproc
    exe myexecueproc
    You'll need to play with the technique but once you understand it you can do all sorts of magic.

  • My wife and I both have iPads, but the time on mine is 4 minutes different and wrong,can I reset the time, does anybody know why it would be different.

    Why is mytimedifferentsfrom someone who is five feet away.

    Go to Settings > General > Date & Time. You can set them manually, or have them automatically srt the time.

  • Error at the time of MIN

    Hi MM experts
    pls help , while doing goods issue through Tcode MB1A
    error "Fld Selection movement type 221 / act 7584896 differ for CO/PP Order (011)"
    is there any movement type assignment to GL code?
    Regards
    Anubhav

    Hi,
    This error is becuase of dif. in field status grouping for mvt. type & G/L account, normally we keep it standard for STd movemnt types, for setting the fields for ur g/l account, use txn : SM30 for view V_T004F, and maintain CO/PP Order (011) as atleast optional.
    you can fidnout the field status group for ur G/L from transaction FS00 in create/bank/interest tab .
    Hope this helps
    Regards
    Dheeraj

  • Regular expression to change Hour:Min:Sec time to Min:Sec using the Search and Replace tool

    Hi,
    I think the title says it all, but I've used a script to export a project from an NLE as a html file with a bunch of images and timecodes within table cells. For example, In=00:00:34 and Out=00:01:30 needs to be converted In=0:34 and Out=1:30. I think the Search and Replace is the most simple way of working that, but I've not experience with Regular Expressions (or much in that regard) so would really appreciate if someone could give me a hand writing the Regular Expression I need to achieve this.
    Thanks in advance,
    James

    Okay, so an example row is:
    <tr>
    <td align="left" valign="top"><p align="left"><img src="Snapshot At Event Start [00-01-22-19].jpg"><br>
    <strong>In: </strong>1:22<br>
    <br>
    </p></td>
    <td align="left" valign="top"><p align="left"><img src="Snapshot At Event End [00-01-24-25].jpg"><br>
    <strong>Out: </strong>1:24<br>
    </p></td>
    <td width="100%" align="left" valign="top"><p><strong>Cut to League Video</strong></p>
      <p><strong>Duration</strong>: 2<br>
      <strong></strong></p></td>
    </tr>
    I need to change it to:
    <tr>
    <td align="left" valign="top"><p align="left"><img src="Snapshot At Event Start [00-01-22-19].jpg"><br>
    <strong>In: </strong>1:22 seconds<br>
    <br>
    </p></td>
    <td align="left" valign="top"><p align="left"><img src="Snapshot At Event End [00-01-24-25].jpg"><br>
    <strong>Out: </strong>1:24 seconds<br>
    </p></td>
    <td width="100%" align="left" valign="top"><p><strong>Cut to League Video</strong></p>
      <p><strong>Duration:</strong> 2 seconds<br>
      <strong></strong></p></td>
    </tr>
    The script itself is something I found somewhere on the internet - it's for Sony Vegas.
    I've highlighted the changes with bold underlined italics.
    Thanks for you help, guys,
    James

  • How to display time with min ,sec in select lis lov - 0-23 hrs and 0-59 min

    Hi,
    How to use time between 0-23 hrs,0-59 min in select list and insert selected value into single column.Like if i select 20:00 hrs,34 min ,value should be insert into single database column.
    Please help me to get the answer of this question.
    Kind Regards,
    Harish Sharma

    One select list would have 24 x 60 entriies. You should use two. One for hours and the other one for minutes. The SQL could be:
    SELECT     LEVEL d, LEVEL r
          FROM DUAL
    CONNECT BY LEVEL < 25;
    SELECT     LEVEL d, LEVEL r
          FROM DUAL
    CONNECT BY LEVEL < 61;The source is static. The actual column (for example :P1_TIME_COLUMN) with source database column is hidden. You would have a computation (PL/SQL Function) on submit which would then bring the two selected values together:
    DECLARE
       v_time   VARCHAR2 (40);
    BEGIN
       v_time := :p1_select_list1 || ':' || :p1_select_list2;
       RETURN v_time;
    END;Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How to display estimated project time as min:sec

    I know how to create an advanced action to display my estimated project time in minutes (thanks lilibiri!) However, it displays in decimal format. I want to convert the decimal format (example 16.79 minutes) to the Minute:Sec format (example 16:47)
    I need an expression to isolate the decimal portion only (example 79). Any ideas?
    Thanks,
    Julie

    Shilpa,
    go to system administratioon-system configuration-support-support desk-browse deployment-check for com.sap.porta.navigation.masthead.par and download it to nwds.
    when you import it to NWDS jar file will be missing so you need to manually add that to PORTAL-INF/private/lib.
    once you do this go to HeaderiView.jsp in PORTAL-INF/jsp folder.
    write
    <%= new java.util.Date()%> after <hbj:form id="HeaderForm">.for that matter u can write this at any line after this statement
    once you do that select qucik par upload from the tool bar and deploy it.
    go to system administration-system configuration-support-support desk-administration console and upload the par file
    before following these steps take a backup of par file
    reward points if helpful

  • At the time of finding redundant component failover information....

    os:redhat linux AS
    oracle:10.2.0.3
    hai..
    i am new to rac.
    if production environment using orace rac with all failover components like two hbas,two fc swithces,four network cards(two for private interconnect, and remaining two for public) and four switches for high availability.my doubt is where can we get the component failure information? for example if we lost the one of the hba, the application availability is always there bcaz due to the redundant component(second hba) and we are not aware of the failover. how can we moniotr these type of failures in os like linux and in oracle also? please guide me....
    v.s.srinivas potnuru.

    Hi,
    On a hardware failure event kernel messages are displayed on logs from Operating System under /var/logs. If redundancy is on hardware level it is transparent to Oracle.
    Regards,
    Rodrigo Mufalani
    http://mufalani.blogspot.com

  • HT201250 How to backup the Time Capsule to an external drive using Time Machine?

    Most of my data is on my Time Capsule since the hard drive on my iMac is too small for my music/movies/pictures and also so multiple devices can wirelessly access the data. I want to back up the files from my iMac and the Time Capsule on an external hard drive using the Time Machine. However, it seems that the Time Machine ignores the Time Capsule as a data source. How can I get this to work?

    No, I don't believe this solves your problem.
    TIme Machine can be used with a Time Capsule as a backup solution from connected macs and their drives but not from network drives, NAS or Time Capsules.
    Thus, if you store files for LAN access on a TC internal drive, and want to back them to the USB/external drive attached to that TC, you cannot use Time Machine to do so.
    Time Machine has not way of backing up ANY Time Capsule or NAS or WInPC or other networked drive, as far as I can tell. You will have to use some other backup software.
    This is exactly what I bought the TC for myself (tried to use the internal drive on the TC as a NAS for my LAN, storing my music and photos and documents and bought a LaCie 2TB USB3 extneral drive to connect to the TC and hoped to be able to use Time Machine to backup the internal drive to the LaCie drive....but this does not work, as TM cannot backup from a network drive or TC device.

  • To set the timer in the Screen for online test

    Hi all,
    This is sujoy here....
    i am developing  a tool in SAP for Evaluation /test of any subject or topic  where i have to incorporate the Timer Concepts as i will set this in the screen which where remaining time will decrease after each second like Online Test using web pages and after a predefined duration of 30 min( or 45 min or something like that) when that preset time is elapsed completly,the "SUBMIT" pushbutton  will be Triggered automatically( if candidate does not press it within the duration).
    Is there any FM or Program regarding this concepts...
    Need your help...
    Regards,
    Sujoy

    Hi Sujoy,
    Addition to my previous post..Use the JavaScript I mentioned in my previous post in the onload of your BSP page. And after 30 minutes or so submit the form, you need to make a addition to the java script given in that link.
    See this code:
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <head>
    <SCRIPT LANGUAGE = "JavaScript">
    <!--
    var secs;
    var timerID = null;
    var timerRunning = false;
    var delay = 1000;
    function InitializeTimer()
        // Set the length of the timer, in seconds
        secs = 50;
        StopTheClock();
        StartTheTimer();
    function StopTheClock()
        if(timerRunning)
            clearTimeout(timerID);
        timerRunning = false
    function StartTheTimer()
        if (secs==0)
            StopTheClock();
            // Here's where you put something useful that's
            // supposed to happen after the allotted time.
            // For example, you could display a message:
            alert("You have wasted 50 seconds.");
            document.form1.submit();
        else
            self.status = secs;
            secs = secs - 1;
            timerRunning = true;
            timerID = self.setTimeout("StartTheTimer()", delay);
    /-->
    </SCRIPT>
    </head>
    <htmlb:content design="design2003" >
      <htmlb:page title  = "Timer test application "
                  onLoad = "InitializeTimer()" >
        <htmlb:form id="form1" >
          <htmlb:button text    = "Submit"
                        id      = "but01"
                        onClick = "myEvent" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    OnInputProcessing you navigate to next page using
    navigation->goto_page( 'second.htm' ).
    Hope this helps...
    Regards,
    Ravikiran.

  • Getting the time zone support right

    When I take an international trip I can never seem to get this right, and calendar events go slip-sliding all over the place.
    I have tried by time zone support on and off, but still previous events seem to get displayed wrong no matter what I do.
    Currently I'm in Tokyo. Next Friday I'm going to St. Louis for a couple of months. I have a customer call on June 6th at 10 am central time. I just added it to my calendar by entering "Call with Coaches on June 6 at 10 am CDT" (see screenshot) and it created this event which correctly shows it taking place on June 7th Japan time. And I added a note about the actual time just in case.
    So how should I have it set so when I am in St. Louis it shows up as June 6 at 10 am?
    And what will happen with all my other events where I typically don't specify a time zone?
    Thanks,
    Doug

    Hey Doug Lerner2,
    Thanks for the question and superb details. I can understand how confusing Time Zone support can sometimes be. In my experience, everything is going to relate back to the main Time Zone Support drop down menu at the top left of the Calendar. This is the easiest way to quickly switch the Time Zone you are viewing.
    Once you travel to St. Louis, simply switch the time zone of your calendar (if it had not automatically switched) to see all of your events in the local time zone (including events that don’t specify a time zone). So if you had your event set for June 6th at 10am CST, once you switch the Time Zone to central time you’ll see that that event is displayed correctly. All of your events that were created in Japan will move to their respective times, and you can also have “Floating” events that will ignore the time zone, and always be at that set time.
    For more information, see these resources:
    Calendar: View all your events in a different time zone
    http://support.apple.com/kb/PH11534
    Calendar: Change an event’s time zone
    http://support.apple.com/kb/PH11531
    Thanks,
    Matt M.

  • Getting the time using UDP

    I have the following class (source code from java core tips):
    public class GetTime {
         final private static int DAYTIME_PORT = 13;
         public static void main(String args[]) throws
         IOException {
              if (args.length == 0) {
                   System.err.println
                   ("Please specify daytime host");
                   System.exit(-1);
              String host = args[0];
              byte message[] = new byte[256];
              InetAddress address = InetAddress.getByName(host);
              System.out.println("Checking at: " + address);
              DatagramPacket packet =
                   new DatagramPacket(message, message.length,
                             address, DAYTIME_PORT);
              DatagramSocket socket = new DatagramSocket();
              socket.send(packet);
              packet =
                   new DatagramPacket(message, message.length);
              socket.receive(packet);
              String time = new String(packet.getData());
              System.out.println("The time at" + host + " is: " + time);
              socket.close();
    I am running this code but it does not show me the time. The host is the 'localhost'. I read that upon a connection to port 13 a response with the data and time should be automatically sent. By me it just prompts this: "Checking at: localhost/127.0.0.1" and it remains like that while it's still running...
    Can anyone tell me what it's wrong. I've tried instead of localhost to give a time server name and changed the port number but it still doesn't work.

    Is the Server running and listening on port 13????

  • Apple TV stays on all the time? Gets really hot.

    Should it just be left on all the time? Mine seems really hot. Is this safe?

    Mac Man wrote:
    Funny because when I do the same thing iTunes never looses the connection with AppleTV. Even with the light off, I can select AppleTV from the iTunes devices and manage the content. My experience has shown that AppleTV never sleeps or turns off.
    correct. itunes still does detect it.
    it appears the peoples definition of sleep differs somewhat.
    i class "sleep" as being in a device in a state where it is using less power than it would when in normal use.
    putting the appletv to "sleep" by holding power/pause for 5 seconds lowers the power consumption... so in my eyes this is "sleep".
    the appletv certainly does "hibernate", but it does "sleep".

Maybe you are looking for