Sql date and util date problem: plz help

Hi,
Following is the scenario I am dealing with....
I have two feilds in the DB, of type Datetime. First field say.. 'DBDate' have date in it, and second field 'DBTime' has time in it. This much part I can not change.... I can change rest of the part so please guide me accordingly....
I am getting both the values from the DB using
long day = rs.getDate("DBDate").getTime();
long tme = rs.getTime("DBTime").getTime();Now I have to create a completly new java.util.Date object using this date and time. So, I am adding both the long values and trying to create a new data object usingjava.util.Date ext = new java.util.Date(day+tme); But the ext date over here is 6 hrs later time than actual text of the Date in the DB. that is if the date and time in the DB is "5/27/2003" and "4:40:00 PM" the resulting date is "5/27/2003 10:40:00 PM", which could be equivalent GMT time w.r.t. the DB Timezone.
But I want the final date to be the same as the DB Time Zone.....
if you need more detailed information reply me... i will post it .....
Thank a lot in advance...
Ri

But the ext date over here is 6 hrs later time than
actual text of the Date in the DB. that is if the date
and time in the DB is "5/27/2003" and "4:40:00 PM" the
resulting date is "5/27/2003 10:40:00 PM", which could
be equivalent GMT time w.r.t. the DB Timezone.
How do you know that that is the date in java?
Are you doing this?
System.out.println("d=" + mydate);
If so, and as previously pointed out, you are printing out a time that is relative to your time zone. Is the time in the database relative to your time zone? If not then you have a problem. And if the time in the database is relative to any time zone other than GMT then your extraction method is incorrect as well.

Similar Messages

  • Getting max date and max time column plz help

    hi
    i have a table with suppose 7 columns with date and time column seperate
    i want to design a query which retrieve the current or the maxmum date with the max of time in that date.
    columns a ,b,c, date, time
    22-05-07 20
    23-05-07 50
    24-05-07 40
    25-05-07 30
    22-05-07 20
    ans " suppose current date is 25 "
    a,b,c,25-05-07,40

    try like this..
    SQL> with rt as
      2  (select 1 col1,'22-05-07' dt, 20 tm from dual union all
      3  select 2,'23-05-07', 50 from dual union all
      4  select 3,'24-05-07', 40 from dual union all
      5  select 4,'25-05-07', 30 from dual union all
      6  select 5,'25-05-07', 45 from dual union all
      7  select 6,'22-05-07', 20 from dual)
      8  select col1,dt,tm from
      9  (select col1,
    10      dt,
    11      max(tm) over(partition by to_date(dt,'DD-MM-RR') order by col1 desc) tm,
    12      row_number() over(partition by to_date(dt,'DD-MM-RR') order by col1 desc) rn
    13  from rt where to_date(dt,'DD-MM-RR') in (select max(to_date(dt,'DD-MM-RR')) dt from rt))
    14  where rn = 1;
          COL1 DT               TM
             5 25-05-07         45
    SQL>

  • Goods Receipt and Goods Issue - Posting Date and Document Date Problem

    Hi All,
    I was using SDK to build own add on to insert Posting Date and Document Date under Inventory> Inventory Transactions> Goods Receipt and  Inventory> Inventory Transactions> Goods Issue, but the UI Screen Posting Date and Document Date shown current date.
    My SAP Business One version was 2007A SP00 PL42 and alreadly upgrade to SP05.
    End up result still the same.
    Is there someone can help me?
    Thanks you.
    Best Regards,
    danny

    Hi there,
    I already solve it by myself.
    Actually is i call the initialization twice:
    Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry)
    Thats what make this problem happened.
    Sorry.
    Best Regards,
    danny

  • Sql time to util date

    hi mates
    can any one give me the java code to convert sql time to util date?
    thanks in advance

    Since java.sql.Time extends java.util.Date it is a
    Date. Am i right here?How about looking it up? Then you'd know.
    Yes, sql.Date extends util.Date.Sorry. I'm getting screen-tired. sql.Time extends util.Date, too. But they only show the time, no date.

  • Very strange problem plz help////

    user name == scott.
    tablespace name == data and users.
    data tablespace content approx.20 tables.
    users tablespace content approx 5 tables.
    both tables are under scott schema...
    i want to reclaim data tablespace size..
    so first i import complete tablespace data. as system user.
    then after i want to drop data tablespace but i got error...
    SQL> drop tablespace data including contents and datafiles;
    drop tablespace data including contents and datafiles
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-02429: cannot drop index used for enforcement of unique/primary key
    plz. sir help how can i drop this tablespace plz. help plz. plz. plz.

    Try
    SQL> drop tablespace data including contents and datafiles cascade constraints;It seems that you have some referential integrity constraints, outside data tablespace, pointing to a table inside data tablespace.

  • N95 maps problem plz help me

    please any body can solve my problem?
    i have n95
    when i open gps application
    then on the screen globe is not showning and no maps are showing on screen
    only city names are showed
    and after the closing of map application in apst there are type on screen
    saving maps and data
    but now nothing typed
    plz help me

    i am using latest firm ware
    and using old maps application bcoz new beta 2.0 not showing my accurate position in pakistan
    if i am in my city
    the maps application shows u r 10 km from your city
    but old version give me accurate position...

  • Meta data,Transaction data and Master data

    Hi all,
    Could you plz make me clear exactly wht does Meta data,Transaction data and Master data mean and the differences

    Hi Ganesh,
    <b>MASTER Data</b> is the data that exists in the organization like employee details, material master, customer master, vendor master etc. These are generally created once.
    Master data are distributed throughout the company, they are often not standardised and often redundant. As a result it is very costly to offer efficient customer service, keep track of supply chains and make strategic decisions. With SAP Master Data Management (SAP MDM) these important business data from across the company can be brought together, harmonised and made accessible to all staff and business partners. As a key component of SAP NetWeaver, SAP MDM ensures data integrity via all IT systems.
    Regardless of the industry, companies often work with different ERP and Legacy systems. The result: the business processes are based on information about customers, partners and products which is displayed in different ways in the systems. If the data are recorded manually, there are more inconsistencies: some data sets are entered several times, others cannot be retrieved by all divisions of the company.
    As corporate applications are becoming increasingly complex and produce ever greater amounts of data, the problem is intensified further. Nevertheless, your employees must work with the inconsistent data and make decisions on this basis. The lack of standardised master data easily leads to wrong decisions, which restrict efficiency and threaten customer satisfaction and profitability.
    In a word: in order to save costs and ensure your company’s success it is necessary to consolidate master data about customers, partners and products, make them available to all employees beyond system boundaries and use attributes valid company-wide for the purpose of description.
    <b>TRASNACTION Data</b> - These are the business documents that you create using the master data - Purchase orders, sales orders etc
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9d/193e4045796913e10000000a1550b0/content.htm
    Regards,
    Santosh

  • Diff B/W master data and transaction data

    Hi all,
    What is the main Diff B/W master data and transaction data.  give me some example ?
    Thanks in Advance
    Krish...

    hi krish,
    MASTER Data is the data that exists in the organization like employee details, material master, customer master, vendor master etc. These are generally created once.
    Master data are distributed throughout the company, they are often not standardised and often redundant. As a result it is very costly to offer efficient customer service, keep track of supply chains and make strategic decisions. With SAP Master Data Management (SAP MDM) these important business data from across the company can be brought together, harmonised and made accessible to all staff and business partners. As a key component of SAP NetWeaver, SAP MDM ensures data integrity via all IT systems.
    Regardless of the industry, companies often work with different ERP and Legacy systems. The result: the business processes are based on information about customers, partners and products which is displayed in different ways in the systems. If the data are recorded manually, there are more inconsistencies: some data sets are entered several times, others cannot be retrieved by all divisions of the company.
    As corporate applications are becoming increasingly complex and produce ever greater amounts of data, the problem is intensified further. Nevertheless, your employees must work with the inconsistent data and make decisions on this basis. The lack of standardised master data easily leads to wrong decisions, which restrict efficiency and threaten customer satisfaction and profitability.
    In a word: in order to save costs and ensure your company’s success it is necessary to consolidate master data about customers, partners and products, make them available to all employees beyond system boundaries and use attributes valid company-wide for the purpose of description.
    TRASNACTION Data - These are the business documents that you create using the master data - Purchase orders, sales orders etc
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9d/193e4045796913e10000000a1550b0/content.htm
    Regards,
    GNK.

  • To get first date and end date after entering any month and year

    Hi,
    I need to to get first date and end date of a month and year in yyyyMMdd format. I am reading month and year from a properties file. But I don't know how to get the first date and End date in given format. The properties file gives me just text. But I don't know how to get the date format using this. I need this urgently. Can anyone help me to get code for this?
    I am reading the fields as,
    Properties props = new Properties();
    props.load(new FileInputStream("AnyMonthVolume.properties"));
    String date_month = props.getProperty("date_month");
    String date_year = props.getProperty("date_year");
    Thanks.

    I know this has been posted a while ago but incase someone looking for it, here is the code to get the end of current month date.
    Calendar cal = Calendar.getInstance();
         cal.setTime(new java.util.Date());
         cal.set(Calendar.DATE, 1); //set the date to start of month
         cal.add(Calendar.MONTH,1);
         cal.add(Calendar.DATE,-1);
    System.out.println(cal.getTime());

  • UNDERSTAND THE NEW DATE AND TIME DATA TYPES IN ORACLE 9I

    제품 : SQL*PLUS
    작성날짜 : 2001-08-01
    UNDERSTAND THE NEW DATE AND TIME DATA TYPES IN ORACLE 9I
    ========================================================
    PURPOSE
    Oracle 9i 에서 소개되는 새로운 datetime data type 에 대해 소개한다.
    Explanation
    Example
    1. Datetime Datatypes
    1) TIMESTAMP
    : YEAR/MONTH/DAY/HOUR/MINUTE/SECOND
    2) TIMESTAMP WITH TIME ZONE
    : YEAR/MONTH/DAY/HOUR/MINUTE/SECOND/
    TIMEZONE_HOUR/TIMEZONE_MINUTE( +09:00 )
    or TIMEZONE_REGION( Asia/Seoul )
    3) TIMESTAMP WITH LOCAL TIME ZONE
    : YEAR/MONTH/DAY/HOUR/MINUTE/SECOND
    4) TIME WITH TIME ZONE
    : HOUR/MINUTE/SECOND/TIMEZONE_HOUR/TIMEZONE_MINUTE
    2. Datetime Fields
    1) YEAR/MONTH/DAY/HOUR/MINUTE
    2) SECOND(00 to 59.9(N) is precision) : Range 0 to 9, default is 6
    3) TIMEZONE_HOUR : -12 to 13
    4) TIMEZONE_MINUTE : 00 to 59
    5) TIMEZONE_REGION : Listed in v$timezone_names
    3. DATE 와 TIMESTAMP 와의 차이점
    SQL> select hiredate from emp;
    HIREDATE
    17-DEC-80
    20-FEB-81
    SQL> alter table employees modify hiredate timestamp;
    SQL> select hiredate from employees;
    HIREDATE
    17-DEC-80 12.00.00.000000 AM
    20-FEB-81 12.00.00.000000 AM
    단, 해당 Column 에 Data 가 있다면 DATE/TIMESTAMP -> TIMESTAMP WITH
    TIME ZONE 으로 Convert 할 수 없다.
    SQL> alter table employees modify hiredate timestamp with time zone;
    alter table employees modify hiredate timestamp with time zone
    ERROR at line 1:
    ORA-01439: column to be modified must be empty to change datatype
    4. TIMESTAMP WITH TIME ZONE Datatype
    TIMESTAMP '2001-05-24 10:00:00 +09:00'
    TIMESTAMP '2001-05-24 10:00:00 Asia/Seoul'
    TIMESTAMP '2001-05-24 10:00:00 KST'
    5. TIMESTAMP WITH LOCAL TIME ZONE Datatype
    SQL> create table date_tab (date_col TIMESTAMP WITH LOCAL TIME ZONE);
    SQL> insert into date_tab values ('15-NOV-00 09:34:28 AM');
    SQL> select * from date_tab;
    DATE_COL
    15-NOV-00 09.34.28.000000 AM
    SQL> alter session set TIME_ZONE = 'EUROPE/LONDON';
    SQL> select * from date_tab;
    DATE_COL
    15-NOV-00 12.34.28.000000 AM
    6. INTERVAL Datatypes
    1) INTERVAL YEAR(year_precision) TO MONTH
    : YEAR/MONTH
    : Year_precision default value is 2
    SQL> create table orders (warranty interval year to month);
    SQL> insert into orders values ('2-6');
    SQL> select warranty from orders;
    WARRANTY
    +02-06
    2) INTERVAL DAY (day_precision) TO SECOND (fractional_seconds_precision)
    : DAY/HOUR/MINUTE/SECOND
    : Logon time 확인시 주로 사용
    : day_precision range 0 to 9, default is 2
    SQL> create table orders (warranty interval day(2) to second);
    SQL> insert into orders values ('90 00:00:00');
    SQL> select warranty from orders;
    WARRANTY
    +90 00:00:00.000000
    7. Interval Fields
    - YEAR : Any positive or negative integer
    - MONTH : 00 to 11
    - DAY : Any positive or negative integer
    - HOUR : 00 to 23
    - MINUTE : 00 to 59
    - SECOND : 00 to 59.9(N) where 9(N) is precision
    8. Using Time Zones
    1) Database operation
    - Defined at CREATE DATABASE
    - Can be altered with ALTER DATABASE
    - Current value given by DBTIMEZONE
    2) Session operation
    - Defined with environment variable ORA_SDTZ
    - Can be altered with ALTER SESSION SET TIME_ZONE
    - Current value given by SESSIONTIMEZONE
    3) TIMESTAMP WITH LOCAL TIMEZONE
    - TIME_ZONE Session parameter
    : O/S Local Time Zone
    Alter session set time_zone = '-05:00';
    : An absolute offset
    Alter session set time_zone = dbtimezone;
    : Database time zone
    Alter session set time_zone = local;
    : A named region
    Alter session set time_zone = 'America/New_York';
    Reference Document
    ------------------

    Hi ,
    I am facing the same problem and my scenario is also same (BAPI's).
    So can you please tell me how you overcome this problem .
    Thanks,
    Rahul

  • Updating text data and master data

    Hello everyone,
    I'm new to the ABAP language and I'm having some trouble with updating and inserting data in my tables. The problem goes like this :
    1) To modify an existing line in my table, I need only to update a text data. So I specify 'T' as tab class in the RSDMD_WRITE_ATTRIBUTES_TEXTS function. The update works fine.
    2) To add a new line to my table, I have to deal with both master data and text data. So I have another RSDMD_WRITE_ATTRIBUTES_TEXTS function this time with 'M' as tab class. I have put this function before the one with 'T' as tab class.
    My problem is that the add a new line doesn't work. I'd be very grateful if anyone could give me some hint. Thank you very much for your help.
    Best Regards,
    Dimple
    Here's my code :
    clear : t_wa_tproginv, t_wa_mproginv, l_wa_mproginv, l_wa_mproginv.
          l_form_fields-id = 'ZPROGINV'.
          read table gt_form_fields from l_form_fields into l_form_fields.
          l_wa_tproginv-/BIC/ZCPROGINV = l_form_fields-frm_val.
          l_wa_mproginv-/BIC/ZCPROGINV = l_form_fields-frm_val.
          l_form_fields-id = 'ZEXAUTO'.
          read table gt_form_fields from l_form_fields into l_form_fields.
          l_wa_tproginv-APPR_YEAR = l_form_fields-frm_val.
          l_wa_mproginv-APPR_YEAR = l_form_fields-frm_val.
          l_wa_mproginv-OBJVERS = 'A'.
          l_form_fields-id = 'ZLANGU'.
          read table gt_form_fields from l_form_fields into l_form_fields.
          l_wa_tproginv-LANGU = l_form_fields-frm_val.
          l_form_fields-id = 'ZPROGINV_TC'.
          read table gt_form_fields from l_form_fields into l_form_fields.
          l_wa_tproginv-TXTSH = l_form_fields-frm_val.
          l_form_fields-id = 'ZPROGINV_TL'.
          read table gt_form_fields from l_form_fields into l_form_fields.
          l_wa_tproginv-TXTLG = l_form_fields-frm_val.
          append l_wa_tproginv to t_wa_tproginv.
          append l_wa_mproginv to t_wa_mproginv.
            call function 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
                exporting
                  i_iobjnm                = 'ZCPROGINV'
                  i_tabclass              = 'M'
                tables
                  i_t_table               = t_wa_mproginv
                exceptions
                  attribute_name_error    = 1
                  iobj_not_found          = 2
                  generate_program_error  = 3
                  others                  = 4.
            if sy-subrc <> 0.
                  lt_err_msg-condition = 'rsdmdmzproginv'. read table gt_err_msgs from lt_err_msg into lt_err_msg.
                  concatenate sy-msgid '/' sy-msgty '/' sy-msgno '/' sy-msgv1 '/' sy-msgv2 '/' sy-msgv2 '/' sy-msgv3 '/' sy-msgv4 into lt_err_msg-message.
                  page->messages->add_message(
                                  condition  = lt_err_msg-condition
                                  message    = lt_err_msg-message
                                  severity   = lt_err_msg-severity ).
            endif.
            call function 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
                exporting
                  i_iobjnm                = 'ZCPROGINV'
                  i_tabclass              = 'T'
                tables
                  i_t_table               = t_wa_tproginv
                exceptions
                  attribute_name_error    = 1
                  iobj_not_found          = 2
                  generate_program_error  = 3
                  others                  = 4.
            if sy-subrc <> 0.
                  lt_err_msg-condition = 'rsdmdmzproginv'. read table gt_err_msgs from lt_err_msg into lt_err_msg.
                  concatenate sy-msgid '/' sy-msgty '/' sy-msgno '/' sy-msgv1 '/' sy-msgv2 '/' sy-msgv2 '/' sy-msgv3 '/' sy-msgv4 into lt_err_msg-message.
                  page->messages->add_message(
                                  condition  = lt_err_msg-condition
                                  message    = lt_err_msg-message
                                  severity   = lt_err_msg-severity ).
            endif.
              call function 'RSDMD_MD_ACTIVATE'
                exporting
                  i_chabasnm = 'ZCPROGINV'.
              call function 'RSDDS_AGGREGATES_MAINTAIN'
               exporting
                 i_protnumber          =  'ZCPROGINV'.
              if sy-subrc <> 0.
                lt_err_msg-condition = 'rsdmdtzproginvchgrun'. read table gt_err_msgs from lt_err_msg into lt_err_msg.
                concatenate sy-msgid '/' sy-msgty '/' sy-msgno '/' sy-msgv1 '/' sy-msgv2 '/' sy-msgv2 '/' sy-msgv3 '/' sy-msgv4 into lt_err_msg-message.
                page->messages->add_message(
                                condition  = lt_err_msg-condition
                                message    = lt_err_msg-message
                                severity   = lt_err_msg-severity ).
              endif.

    I found the prob. It was elsewhere. Thx anyway.

  • Basic dates and production dates

    dear all,
    i have made a PIR using MD61 for 01.04.2010,
    after that, i run the MRP using MD02 to make the planned order, so when i open the MD04 tcode, the planned order has been created for 01.04.2010 too...
    the problem is when i convert that planned order to production order, when i check the finish date of the production order, it has been change to 02.04.2010, why the start dates and finish dates changes in the production order???
    best regard,
    MARUFAT

    Hi,
    i have check in OPU3, the schduling type is backward, and the automatic scheduling is tick
    i also check in MRP view, the scheduling margin key is 000 so there is no float time problem, and the GR processing time is 0,
    i run the MRP RUn MD02 using planning type 1 using basic dates
    but when i convert the planned order into production order, the finish date always change,
    so, if the finish date in the planned order is 01.04.2010 , after i convert into production order, the finish date change into 02.04.2010
    what makes me confuse is that the scheduling time is backward, but why all the finish date of the planned order after i convert to production order change into +1 days after the finish dates ??
    can you help me to solve this problem?
    regard
    MARUFAT

  • Split Spry.Data and Spry.Data.Region from SpryData.js?

    I don't like Spry.Data.Region or anything like Spry.*.Region because it make hard to customize using javascript.
    But Spry.Data with Observer / Notify feature is great one. In fact, using SpryData.js, I can write my own "render html object" easier.
    SrpyData.js is big (127KB) even when compressed, it is still 65KB. That why, needed split Spry.Data and Spry.Data.Region from SpryData.js so who want to use Spry.Data only like me will get smaller trafic.
    I've tried remove all Spry.Data.Region content in SpryData.js. Surprise, some in Spry.Data call to Spry.Data.Region >>> Design have problem.
    Anyone can help splitting them?

    Found this in the archives:
    <div spry:if="{ds_RowCount} == 0" class="trigger" style="display:none"></div>
    Basically a hack to point the tooltip to a hidden div so no errors are thrown.

  • Completion Data and Resume Data

    Again, it seems there is yet another Completion Data and Resume Data question... sorry.
    My issue is that completion data isn't always being sent from my SCORM material to my LMS. I know there is a setting to set the completion data at X percent, but even then I would like to have something a bit more trusting on it. Is there a way (and I'm no developer/program/IT guy so please help in detail) to make so that on X slide that completion data is forced to be sent?
    This also plays into my next question: is there a way to force resume data on every page, every load? The bookmark feature is nice thank you Adobe staff for adding that, but its reliability for what my company is using is questionable at best. If there is no progress made within the lesson the resume data after having used it once isn't sent again - I need this to be sent on every slide upon entering or even better at a preset time on the slide, and always be sent regardless of number of accesses. Is this possible? It would solve a whole host of problems one being that we need to have the test scores entered into our LMS after a successful completion, and then have the slide fade out so the user cannot re-access, redo, copy, etc the quizzes.
    Thank you for the help,
    -Joseph

    I can't really help you with most of your questions, but I can confirm that a slide needs to be viewed 100% from start to end of the timeline before Captivate treats it as "read/viewed". It's the same problem when you are using the TOC - it will not get the check mark until the slide has played from A-Z, which is really annoying.
    /Michael
    Visit my Captivate blog with tips & tricks, tutorials and Widgets.

  • Difference between master data and transactional data

    Hi experts i have just started learning BW can u plz let me know the difference between Master data and Transactional data in bw ? and why is master data is first loaded before the transactional data ? thanks .....

    Hi
    Transaction data represents any transaction occured between two parties like Customer and Vendor.
    We maintain id's to maintain the Customer and Vendor.
    When we look at the id we don't have a clue like who is the customer, where does he live,,....
    So all this info is maintained in Master data in three categories:
    1. Attributes
    2. Text
    3. Hierarchies.
    Collection of Attribute, Texts and Hierarchies is called master Data in BI/BW.
    Eg: 0MATERIAL, 0CUSTOMER,,,,,
    Master data: is data that remains unchanged over a long period of time. Master data contains information that is always needed in the same way. Characteristics can bear master data in BW. With master data you are dealing with attributes, texts or hierarchies.
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/58/a4513ce4af0a40e10000000a114084/frameset.htm
    Master Data is one form of the historical data. There is no frequent changes in the data.Every application has it's own Master Data.
    In BI the master Data has been divided into
    Characterstics
    Texts
    Hierarchies
    We can load Master Data through different ways.
    Pls. find the below link
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/58/a4513ce4af0a40e10000000a114084/frameset.htm
    hope it helps u
    regards
    gaurav

Maybe you are looking for