Hour,Minute,Second is truncated in output for start_date.

CREATE or REPLACE PROCEDURE First(
firstName_Entity OUT TEST.RefCsr
AS
CURSOR c1
IS
SELECT first_name,start_date FROM employee;
firstLastName pkg.output;
BEGIN
OPEN c1;
FETCH c1 BULK COLLECT INTO firstLastName;
CLOSE c1;
EXECUTE IMMEDIATE 'CREATE TABLE TEMP(first_name VARCHAR2(25),start_date DATE)';
FOR i IN 1..firstLastName.count
loop
EXECUTE IMMEDIATE 'INSERT INTO TEMP
SELECT ' ||
q'[']' ||
firstLastName(i).first_name ||
q'[',']' ||
firstLastName(i).start_date ||
q'[']' ||
' FROM DUAL';
end loop;
OPEN firstName_Entity FOR 'SELECT * FROM temp';
EXECUTE IMMEDIATE 'DROP TABLE TEMP';
END;
CREATE OR REPLACE PACKAGE pkg
AS
TYPE rec_out IS RECORD(FIRST_NAME VARCHAR2(10),start_date Date);
TYPE output IS TABLE OF rec_out;
END;
Actually in employee table HH:MM:SS is present in 'start_date' column. But in output its truncated,
when i comment the line "EXECUTE IMMEDIATE 'DROP TABLE TEMP';", I found in temp table also HH:MM:SS is truncated in column start_date.
What will be solution of this, what should i modify in code?

@BluShadoew,
So thanks for reply, As suggested(about creating global temporary table) by u i changed code,My modified code looks like
SELECT owner, object_name,TO_CHAR(created, 'DD/Mon/YY HH24:MI') created,TO_CHAR(last_ddl_time, 'DD/Mon/YY HH24:MI') changed,
status FROM dba_objects WHERE created > SYSDATE-1 OR last_ddl_time > SYSDATE-1
CREATE or REPLACE PROCEDURE First(
firstName_Entity OUT TEST.RefCsr
        AS
            CURSOR c1
                        IS
                        SELECT first_name,start_date FROM employee;
firstLastName pkg.output;
BEGIN
OPEN c1;
FETCH c1 BULK COLLECT INTO firstLastName;
CLOSE c1;
FOR i IN 1..firstLastName.count
loop
EXECUTE IMMEDIATE 'INSERT INTO FTEMP (first_name, start_date) VALUES (:x, :y)' USING firstLastName(i).first_name, firstLastName(i).start_date;
end loop;
OPEN firstName_Entity FOR 'SELECT * FROM Ftemp';
END;
CREATE OR REPLACE PACKAGE pkg
AS
TYPE rec_out IS RECORD(FIRST_NAME VARCHAR2(10),start_date Date);
TYPE output IS TABLE OF rec_out;
END;
CREATE GLOBAL TEMPORARY TABLE Ftemp(First_Name VARCHAR2(25),start_date DATE)
create or replace PACKAGE "TEST"
AS
  TYPE RefCsr IS REF CURSOR;
END TEST;
/I executed this stored procedure using sqlplus and got message "Procedure Created" .
then i executed command select object_name from user_objects where status='INVALID' and no row is selected.
I am calling above stored procedure by java code,
My typical java code is
sql = "{ Call First(?) } ";
stmt = conn.prepareCall(sql);
stmt.registerOutParameter(1,-10);
stmt.execute();
List result = new ArrayList();
ResultSet rs = (ResultSet)stmt.getObject(1);
            java.sql.ResultSetMetaData rsMetaData = rs.getMetaData();
            System.out.println("Number of columns in resultSet "+rsMetaData.getColumnCount());
             int numberOfColumns=rsMetaData.getColumnCount();
             List col = new ArrayList();
             while(rs.next())
                     col = new ArrayList();
                      for(int k=1;k<=numberOfColumns;k++)
                          System.out.println(" rs.getString(k) "+rs.getString(k));
               }But while calling above stored procedure from java code i am getting error,
My log message is
java.sql.SQLException: ORA-08103: object no longer exists
12:02:48,320 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
12:02:48,320 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
12:02:48,320 ERROR [STDERR]     at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
12:02:48,321 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
12:02:48,321 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
12:02:48,321 ERROR [STDERR]     at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
12:02:48,322 ERROR [STDERR]     at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
12:02:48,322 ERROR [STDERR]     at oracle.jdbc.driver.T4CStatement.fetch(T4CStatement.java:1073)
12:02:48,322 ERROR [STDERR]     at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:359)
12:02:48,323 ERROR [STDERR]     at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:263)
12:02:48,323 ERROR [STDERR]     at org.apache.jsp.second_jsp.jspInit(second_jsp.java:105)
12:02:48,323 ERROR [STDERR]     at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:51)
12:02:48,323 ERROR [STDERR]     at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:154)
12:02:48,324 ERROR [STDERR]     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
12:02:48,324 ERROR [STDERR]     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
12:02:48,324 ERROR [STDERR]     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
12:02:48,324 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
12:02:48,325 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
12:02:48,325 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
12:02:48,325 ERROR [STDERR]     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
12:02:48,325 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
12:02:48,326 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
12:02:48,326 ERROR [STDERR]     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
12:02:48,326 ERROR [STDERR]     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
12:02:48,327 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
12:02:48,327 ERROR [STDERR]     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
12:02:48,327 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
12:02:48,327 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
12:02:48,328 ERROR [STDERR]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
12:02:48,328 ERROR [STDERR]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
12:02:48,329 ERROR [STDERR]     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
12:02:48,329 ERROR [STDERR]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
12:02:48,329 ERROR [STDERR]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
12:02:48,329 ERROR [STDERR]     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
12:02:48,329 ERROR [STDERR]     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
12:02:48,330 ERROR [STDERR]     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
12:02:48,330 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:619)I am not able to understand,where i am going wrong?
'SELECT first_name,start_date FROM employee' query should result as 5 rows.
Edited by: BluShadow on 24-Aug-2011 08:56
added {noformat}{noformat} tags.  Please read {message:id=9360002} to learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • FM for microseconds to  hours : minutes : seconds : microseconds conversion

    Hi Expart ,
                    Is there is any Fm to Convert  microseconds to  hours : minutes : seconds : microseconds. Actually i get the runtime in Micro second and i need to display it in above format .
    Please help me to get the fm or other simple way to do this
    Thanks
    Raju

    Hi,
    Use this link
    FM to converts seconds into HH:MM:SS
    Function Module for converting seconds into hours and minutes
    Hope these will help you.
    Regards,
    Vijay

  • Localized text for hour, minute, second, week, today, etc.

    You are able to get localized text for the weekday name, e.g. to get your localized name of "monday", use
    SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
    String name = sdf.format(gregorianCalendar.getTime())for month names, you would use the format String MMMM:
    SimpleDateFormat sdf = new SimpleDateFormat("MMMM");Are there additional localized text available through some API? I'm looking for translations for "next", "previous", "day", "week", "month", "year", "hour", "minute", "second", "now", "today", "OK", "Cancel". (Of course, I could translate these myself and offer a MessageBundle, but if there are already translations down there through the API, why do work twice ;-)

    You are able to get localized text for the weekday name, e.g. to get your localized name of "monday", use
    SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
    String name = sdf.format(gregorianCalendar.getTime())for month names, you would use the format String MMMM:
    SimpleDateFormat sdf = new SimpleDateFormat("MMMM");Are there additional localized text available through some API? I'm looking for translations for "next", "previous", "day", "week", "month", "year", "hour", "minute", "second", "now", "today", "OK", "Cancel". (Of course, I could translate these myself and offer a MessageBundle, but if there are already translations down there through the API, why do work twice ;-)

  • Is there a data element for time unit (Hour, minute, second) and so forth)

    Thanks for your help.

    Hi Raja,
    I just want to add something in the drop down list
    'Hour'
    'Minute'
    'Second'
    I hope I can get these values from a domain value range.
    Could you please assist ?
    Anders

  • Displaying the hour, minute, seconds.....

    Hi fellow experts!
    Once again I call upon you for help. I'm strugglng with the formatting of dates...specifically the hour, minute, seconds between two dates.
    Sample data:
    create table test (script_name varchar2(50),run_start date,run_end date, job_id number, parent_job_id number);
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('IMPORTMTM','09-FEB-10','09-FEB-10','2409671','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('INT_EOD_VALUATIONS','09-FEB-10','09-FEB-10','2409673','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('ACC_EOD_FXACCOUNTING','09-FEB-10','09-FEB-10','2409677','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('GLO_EOD_FXUPDATE ','09-FEB-10','09-FEB-10','2409679','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('MX_PREACCOUNTING_BACKUP_RP','09-FEB-10','09-FEB-10','2409683','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('DM_PREACCOUNTING_BACKUP_RP','09-FEB-10','09-FEB-10','2409684','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('IMP_FIXING','09-FEB-10','09-FEB-10','2409688','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('GLO_EOD_FIXINGIRD','09-FEB-10','09-FEB-10','2409690','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('WAIT_5_MINS','09-FEB-10','09-FEB-10','2409692','2409645');
    The output of the time should look like the results from the query below:
    select floor((run_end-run_start)*24) as Hrs ,floor(((run_end-run_start)*1440 - floor((run_end-run_start)*24)*60)) as Mins,
    ceil(((run_end-run_start)*86400 - floor((run_end-run_start)*1440)*60)) as Secs
    from (
    select to_date('10-oct-2003 15:02:23','DD-Mon-YYYY HH24:Mi:SS') as run_start,
    to_date('10-oct-2003 16:20:20','DD-Mon-YYYY HH24:Mi:SS') as run_end
    from dual);
    i.e
    H M S
    1 17 57
    My current sql is:
    select script_name,
    run_start,
    run_end,
    floor((run_end-run_start)*24) as Hrs ,floor(((run_end-run_start)*1440 - floor((run_end-run_start)*24)*60)) as Mins,
    ceil(((run_end-run_start)*86400 - floor((run_end-run_start)*1440)*60)) as Secs
    from (
    select lpad(' ',5*level,' ')||name script_name
    ,to_date(run_start,'dd-mon-yyyy hh24:mi:ss') run_start, to_date(run_end,'dd-mon-yyyy hh24:mi:ss') run_end,
    sys_connect_by_path(to_date(run_start,'dd-mon-yyyy hh24:mi:ss'),'/') root_start
    from jcs_jobs
    connect by prior job_id = parent_job_id
    start with PARENT_JOB_ID IS NULL and job_id = 2409645
    I need a slight tweak somewhere, but can't quite get there!
    Oracle version is 9i
    Many thanks for your help in advance.
    Dev

    Hi,
    Devski Peters wrote:
    ......sorry, I didn't make myself clear.....Sorry, this message made things even less clear.
    Like Bhushan, I don't see any relationship between the data you posted:
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('IMPORTMTM','09-feb-2010 20:00:02','09-feb-2010 20:00:44','2409671','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('INT_EOD_VALUATIONS','09-feb-2010 20:00:44','09-feb-2010 20:01:03','2409673','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('ACC_EOD_FXACCOUNTING','09-feb-2010 20:01:05','09-feb-2010 20:01:24','2409677','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('GLO_EOD_FXUPDATE ','09-feb-2010 20:01:24','09-feb-2010 20:01:43','2409679','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('MX_PREACCOUNTING_BACKUP_RP','09-feb-2010 20:01:45','09-feb-2010 20:01:49','2409683','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('DM_PREACCOUNTING_BACKUP_RP','09-feb-2010 20:01:45','09-feb-2010 20:01:49','2409684','2409645');
    insert into test (script_name,run_start,run_end,job_id,parent_job_id) values ('IMP_FIXING','09-feb-2010 20:01:51','09-feb-2010 20:02:15','2409688','2409645');and the results you want:
    NORMAL_DAY     09-feb-2010 18:05:00     10-feb-2010 04:22:45     20'681'879.88
    Step 1 of NORMAL_DAY     09-feb-2010 18:05:00     09-feb-2010 18:05:24     575.88
    Step 2 of NORMAL_DAY     09-feb-2010 18:05:24     09-feb-2010 18:05:46     527.88
    EOD_FX_RATE_UPLOAD     09-feb-2010 18:05:24     09-feb-2010 18:05:46     527.88
    Step 1 of EOD_FX_RATE_UPLOAD     09-feb-2010 18:05:24     09-feb-2010 18:05:30     143.88
    FX_FTPS_GET_EOD     09-feb-2010 18:05:26     09-feb-2010 18:05:30     95.88
    Step 2 of EOD_FX_RATE_UPLOAD     09-feb-2010 18:05:30     09-feb-2010 18:05:45     359.88
    FXSPOTS     09-feb-2010 18:05:31     09-feb-2010 18:05:45     335.88
    Step 3 of EOD_FX_RATE_UPLOAD     09-feb-2010 18:05:45     09-feb-2010 18:05:46     23.88
    SEND_MAIL_FXSPOTS     09-feb-2010 18:05:45     09-feb-2010 18:05:46     23.88
    Step 3 of NORMAL_DAY     09-feb-2010 18:05:46     09-feb-2010 18:06:10     1'535.88
    CALENDAR_UPLOAD     09-feb-2010 18:05:47     09-feb-2010 18:06:10     1'511.88
    Step 1 of CALENDAR_UPLOAD     09-feb-2010 18:05:47     09-feb-2010 18:05:53     143.88
    CALENDAR     09-feb-2010 18:05:47     09-feb-2010 18:05:53     143.88
    Step 2 of CALENDAR_UPLOAD     09-feb-2010 18:05:53     09-feb-2010 18:06:00     1'127.88
    MDS_STOP     09-feb-2010 18:05:53     09-feb-2010 18:06:00     1'127.88
    Step 3 of CALENDAR_UPLOAD     09-feb-2010 18:06:00     09-feb-2010 18:06:03     71.88
    MDS_HOLIDAY     09-feb-2010 18:06:00     09-feb-2010 18:06:03     71.88
    Step 4 of CALENDAR_UPLOAD     09-feb-2010 18:06:03     09-feb-2010 18:06:10     167.88Do you really want that data to produce that output?
    If the results are not from that data, then post a consistent set of data and results.
    When you have poted some sample data and the results you want from that data , explain how you get those results. Pick a couple of rows of output, and explain how you got every column in the results from the data. Be specific.
    The table has a 'pig ear' relationship......so job_id can have the same parent_job_id.....What is a "pig ear" relationship? (I like the name.)
    >
    The connect by allows me display the results with indentation, so the results will look like:The results look completely unformatted on my browser.
    When you post any formatted text on this site, type these 6 characters:
    (small letters only, inside curly brackets) before and after each formatted section.
    So for example,the first line shows a time of 20'681'879.88, which works out to 10:18 hours approx. Explain the relationship between 20'681'879.88 and "10:18 hours". (Do you mean 10 hours plus 18 minutes?)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • About year(), month(), date(), hour(), minute(), second() in Oracle

    In DB2, I can get the value of year, month, date, hour, minute, second from current timestamp by year(), month(), date(), hour(), minute(), second(). Like below SQL,
    SELECT current timestamp, year(current timestamp), month(current timestamp), date(current timestamp), hour(current timestamp), minute(current timestamp), second(current timestamp) FROM DUAL
    In Oracle, how can I modify above SQL?
    That is, do we have the corresponding function to each one of them in DB2?
    Thanks,
    JJ

    Hi Turloch,
    Thanks for your help.
    Here, I have another question.
    How about the days caculation?
    For example, in DB2, I have a SQL as below,
    select
    account_no
    from
    lit_transaction
    where
    ( start_date + no_of_days days - exp_days days) <= CURRENT DATE
    How can I modify above days caculation for Oracle?
    Thanks,
    J.

  • DatePicker: clear hours, minutes, seconds?

    Hi,
    I am using one date picker to compute the difference between two dates. In the Interface Builder I have declared the date picker as date only. But the date passed from the date picker to the NSDate field has hours, minutes, second on it. For some reason the hours, minutes, seconds is different from my first date to the 2nd date (shown below). For this calculation I am only interested in whole days and the hours, minutes, and seconds are getting in the way of my calculation. Is there any way to use only whole days, or to set the hours, minutes, seconds to zero before I call timeIntervalSince1970?
    NSDate *xbuydate = datePicker.date;
    NSLog(@"xbuydate : %@", xbuydate);
    buyElapsed = [xbuydate timeIntervalSince1970];
    NSLog result:
    5/26/09 3:49:18 PM AA-tab bar[596] xbuydate : 2000-01-01 17:00:00 -0700
    NSDate *xselldate = datePicker.date;
    NSLog(@"xselldate : %@", xselldate);
    sellElapsed = [xselldate timeIntervalSince1970];
    NSLog result:
    5/26/09 3:49:33 PM AA-tab bar[596] xselldate : 2007-12-31 15:49:22 -0700

    Hi, this is my version: -)
    @implementation NSDate(Utils)
    - (NSDate *)truncateToDay
    NSDate *result;
    if (self == nil) {
    return nil;
    } else {
    unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
    NSDateComponents *comps = [[NSCalendar currentCalendar] components:unitFlags fromDate:self];
    result = [[NSCalendar currentCalendar] dateFromComponents:comps];
    return result;
    Works without a problem so far.

  • Save date with precision (Hour, Minutes, seconds ) using V.O.

    Hi all,
    I'm using Jdeveloper 11g.
    I have an Entity object with a column called 'createdOn' of type Date and an entity based View Object with the same type.
    I'm trying to save today's Date with precision (day, month, year, hour, minutes, seconds) Using the view Object, but when I look in the Data Base, always appears the date without time.
    Here is my code in the application Module to save the data, I've tried some things but nothing...
    First I've tried using oracle.jbo.domain.Date, and I've tryed using Calendar as well. Nothing with
    ViewObjectImpl voSample = getSamples1View1();
    //Date creation for View Object
    oracle.jbo.domain.Date today = new Date(Date.getCurrentDate());
    //Calendar today = Calendar.getInstance();
    //loop through the list of samples (TESTGROUPTYPES), and create the objects
    while( it.hasNext())
    Row rowSample = voSample.createRow();
    SequenceImpl sequence = new SequenceImpl("SAMPLES_SEQ", voSample.getApplicationModule());
    rowSample.setAttribute("SampleId", sequence.getSequenceNumber());
    rowSample.setAttribute("CollectionId", stCollectionId);
    rowSample.setAttribute("TestgroupType",it.next());
    rowSample.setAttribute("UnitId",stUnitId);
    rowSample.setAttribute("SampleStatus", "ORDERED");
    rowSample.setAttribute("SampleBackup", "false");
    rowSample.setAttribute("CreatedOn", today);
    voSample.insertRow(rowSample);
    voSample.getApplicationModule().getTransaction().commit();
    Any help will be usefull,
    thanks in advance
    XAVI.

    Hello John,
    yes, I changed the date mask using
    alter session set NLS_DATE_FORMAT='DD/MM/YYYY-hh24:mi:ss'
    if i execute to_char(<date_column>, 'YY-MON-DD HH:MI:SS') on that column, the result is:
    09-MAY-27 12:00:00
    09-MAY-27 12:00:00
    09-MAY-27 12:00:00
    To launch the queries and see the results I'm using the JDeveloper's SQL WorkSheet.
    I can update the data and time and the time persists in the DB
    08-FEB-26 08:07:56
    so, i think there's something in hte EO, VO or App Module method that I'm doing wrong...
    The Entity Attribute is confirured:
    name: CreatedOn
    Type: Date
    Value type: literal
    Values checked: Persistent, Precision Rule and Queryable
    database column: CREATED_ON, type: DATE
    The View attribute is configured:
    Name: CreatedOn
    Type: Date
    Value type: Literal
    checked: Mapped to Column or SQL, Selected in query, queryable
    query column: Alias: CREATED_ON, Type: DATE

  • Converting seconds to hours + minutes + seconds

    hey all,
    was just looking for the quickest way to convert seconds to hours + minutes + seconds
    eg, 18084 s is 5h, 1m, 24s.

    You can use the Apache Commons Lang DurationFormatUtils class
    import org.apache.commons.lang.time.*;
    public class SecondsConversion {
         public static void main(String[] args) {
              try {
                   int seconds = 18084;
                   int milliseconds = seconds * 1000;
                   String[] values = DurationFormatUtils.formatDuration(milliseconds, "H m s").split(" ");
                   System.out.println(values[0] + "h " + values[1] + "m " + values[2] + "s ");
              } catch (Exception e) {
                   e.printStackTrace();
    }

  • Unable to exract hour,minute,seconds from current_timestamp or systimestamp

    Hi All,
    I am trying to extract hour,minute,seconds from systimestamp/current_timestamp using extract function but unable to get the correct o/p.
    I am getting the correct o/p using the to_char function but i want to know is it not possible to use extract function to achieve the same?
    Following are the queries i tried.
    ALTER SESSION SET time_zone = local;
    SELECT current_timestamp,
    EXTRACT(hour FROM current_timestamp) hour_part,
    EXTRACT(minute FROM current_timestamp) minute_part,
    EXTRACT(second FROM current_timestamp) seconds_part,
    EXTRACT(timezone_hour FROM current_timestamp) TH,
    EXTRACT(timezone_minute FROM current_timestamp) TM
    FROM dual;
    Output:
    25-AUG-10 12.24.43.590000000 PM ASIA/CALCUTTA     6     54     43.59     5     30
    Here hour_part is coming has 6 instead of 12(from current_timestamp), minute has 54 instead of 24.
    Please help me on this.
    Thanks in Advance

    Hi,
    If you whish to use a TZ, you should use the localtimestamp instead:
    ALTER SESSION SET TIME_ZONE = ' ASIA/CALCUTTA';
    select '1',current_timestamp,EXTRACT(hour FROM current_timestamp) hour_part,
    EXTRACT(minute FROM current_timestamp) minute_part,
    EXTRACT(second FROM current_timestamp) seconds_part from dual
    union all
    select '2', LOCALTIMESTAMP,EXTRACT(hour FROM LOCALTIMESTAMP) hour_part,
    EXTRACT(minute FROM LOCALTIMESTAMP) minute_part,
    EXTRACT(second FROM LOCALTIMESTAMP) seconds_part from dual
    '1'     CURRENT_TIMESTAMP     HOUR_PART     MINUTE_PART     SECONDS_PART
    1     8/25/2010 1:06:39.071283 PM +05:30     7     36     39.071283
    2     8/25/2010 1:06:39.071283 PM +05:30     13     6     39.071283http://download.oracle.com/docs/cd/B13789_01/server.101/b10759/functions033.htm
    (your difference comes from the TZ ASIA/CALCULTA) : 05:30
    Edited by: user11268895 on Aug 25, 2010 9:39 AM
    Edited by: user11268895 on Aug 25, 2010 9:39 AM

  • Adding day/hour/minute/second to a date value

    How does one add a day/hour/minute/second to a date value?

    SQL> select to_char(sysdate, 'DD/MM/YYYY HH24:MI:SS') to_day,
      2         to_char(sysdate+1, 'DD/MM/YYYY HH24:MI:SS') add_day,
      3         to_char(sysdate + 1/24, 'DD/MM/YYYY HH24:MI:SS') add_hour,
      4         to_char(sysdate + 1/(24*60), 'DD/MM/YYYY HH24:MI:SS') add_minute,
      5         to_char(sysdate + 1/(24*60*60), 'DD/MM/YYYY HH24:MI:SS') add_second
      6  from dual
      7  /
    TO_DAY              ADD_DAY             ADD_HOUR            ADD_MINUTE          ADD_SECOND
    10/10/2006 11:54:23 11/10/2006 11:54:23 10/10/2006 12:54:23 10/10/2006 11:55:23 10/10/2006 11:54:24
    SQL>Cheers
    Sarma.

  • Write elapsed time to a spreadsheet in hours:minutes:seconds format

    Hi everyone,
    I've been trying to write an elapsed time to a spreadsheet file in an hours:minutes:seconds format, but the time is displayed in a floating point value of seconds..
    how can I write to a spreadsheet in an hours:minutes:seconds format.
    Thank you,
    James-

    I often use a subVI that converts Seconds to Hours, Minutes and Seconds. Use the Quotient and Remainder function to divide your elapsed time by 3600, 60 and 1. You can then convert those values to a modified string and use the Write to Spreadsheet File.
    As Dennis said, newer versions of LabVIEW's Write to Spreadsheet File.VI can handle arrays of Double, Integer or String automatically, and in older versions, the Write to Spreadsheet File.VI can be modified and copied to handle strings.
    Hope this helps.
    (Written in 8.5)
    Message Edited by LabViewGuruWannabe on 01-18-2008 09:28 PM
    Attachments:
    TimeToSpreadsheet.vi ‏26 KB
    SecondstoHMS.png ‏32 KB

  • Convert seconds to Days, hours, Minutes, Seconds in Reporting Services

    Hi Guys,
    Im currently reporting of an analysis services cube, however I have value which is in seconds and would like to report on this in reporting services as day:HH:MM:SS.
    Has anyone got any experience reporting in this format?
    Regards
    Dave

    Hi Dave,
    We can use custom code to convert seconds to HH:MM:SS
    Public Function Calculate(ByVal TotalSeconds as Integer) as String
    Dim Hours, Minutes, Seconds As Integer
    Dim Hour, Minute, Second As String
    Hours = floor(TotalSeconds/ 3600)
    IF Hours<10
       Hour="0" & Hours.ToString
    Else
       Hour=Hours.ToString
    End IF
    Seconds = TotalSeconds Mod 3600
    Minutes =floor( Seconds / 60)
    IF Minutes<10
       Minute="0" & Minutes.ToString
    Else
       Minute=Minutes.ToString
    End IF
    Seconds = Seconds Mod 60
    IF Seconds<10
       Second="0" & Seconds.ToString
    Else
       Second=Seconds.ToString
    End IF
    Return Hour & ":" & Minute & ":" & Second
    End Function
    Then we can use the expression to conver it.
    =Code.Calculate(Fields!Column.Value)
    The report looks like below:
    If you have any questions, please feel free to ask.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Latest itunes shows silly days approximation instead of days, hours, minutes, seconds, how do i change back?

    itune 11.0.0.163 shows silly date approximation on bottom bar rather than days, hours, minutes, seconds as before. How do I change this?

    Apple buried the transfer purchases option, but it's still there. To transfer purchases from your iOS device in iTunes:
    Select the device toward the top-middle of iTunes (underneath the status area/progress bar/Apple logo).
    Go to the File menu.
    Select Devices
    Click on Transfer Purchases from [DeviceName]...

  • Calcuate Hours: Minutes:Seconds between two dates excluding Weekends

    Hello All,
    @StartDate = '2014-06-21 13:37:30:037'
    @EndDate = GetDate()
    I want to find out Hours:Minutes:Seconds between the above dates EXCLUDING WEEKENDS.
    Please help.
    ReportingServices

    Hi,
    Give this a try:
    DECLARE @StartDate DATETIME = '2014-06-21 13:37:30:037'
    DECLARE @EndDate DATETIME = GETDATE()
    DECLARE @Base INT = 86400 -- ie Seconds in a days
    ;WITH cteCalculation AS (
    SELECT ((
    (DATEDIFF(dd, @StartDate, @EndDate) + 1)
    -(DATEDIFF(wk, @StartDate, @EndDate) * 2)
    -(CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)
    -(CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)
    ) * @Base)
    -(CASE WHEN DATENAME(dw, @StartDate) NOT IN ('Saturday', 'Sunday') THEN DATEPART(hh, @StartDate) * 3600 + DATEPART(mi, @StartDate) * 60 + DATEPART(ss, @StartDate) ELSE 0 END)
    -(CASE WHEN DATENAME(dw, @EndDate) NOT IN ('Saturday', 'Sunday') THEN @Base - (DATEPART(hh, @EndDate) * 3600 + DATEPART(mi, @EndDate) * 60 + DATEPART(ss, @EndDate)) ELSE 0 END)
    AS DiffInSec
    SELECT @StartDate
    ,@EndDate
    ,CAST(DiffInSec / 3600 AS VARCHAR(10)) + ':' +
    RIGHT('0' + CAST((DiffInSec % 3600) / 60 AS VARCHAR(2)), 2) + ':' +
    RIGHT('0' + CAST((DiffInSec % 3600 % 60) AS VARCHAR(2)), 2)
    FROM cteCalculation
    Feel free to modify to suit your needs!
    Hope this helps.
    ~J.

Maybe you are looking for

  • HTTP Receiver Adapter : Dynamic URL

    Hi, I have a scenario where I wish to build a dynamic URL for the HTTP Receiver Adapter. The URL will contain a customer number which is present in the mapping. The help seems to suggest that this is possible : <i>If you want to use an HTTP destinati

  • Price in PO / Invoice.

    Hi all, I am trying to input my Material price in PO as U$12.5434. I encounter the below error:(in MIRO also). “Input should be in the format ___.___.__~,__”. Price is rounding with 2 decimals Eg- U$12.54 or 12.50. I would like to know: A) Is it SAP

  • Selection screen variant default value

    Hi, I have a hidden parameter defined of type sy-slset to store the current selected variant. Now how do i make sure that this parameter will contain the actual variant name now matter whether the program is executed in background or foreground.

  • FD10N and Sp GL Transactions

    Hi Does FD10N triggers special GL transactions also? Thanks Sanjay

  • BOLD FONT IN ADOBE FORM

    hi experts ,                      I have one requirement  , I am developing one adobe form where I am getting one paragraph from read_text function module,                      and I am passing this table in my form layout                      now th