Consideration of dbtimezone value for date conversion? right or wrong

Hi,
I am working on Day Light Saving issue in my application that uses the US based oracle 10g db and now having dbtimezone value as PDT, as part of DST changes we have written below function.
Pacific Standard Time (PST) = GMT-8
Pacific Daylight Time (PDT) = GMT-7
CREATE OR REPLACE FUNCTION GET_GMT_DATE (v_date DATE)
RETURN DATE AS
ndate DATE := v_date;
TIMEZONE VARCHAR(7) := NULL;
BEGIN
select TRIM(dbtimezone) INTO TIMEZONE from dual;
IF TIMEZONE = '-07:00' THEN
ndate := NEW_TIME(ndate, 'PDT', 'GMT');
ELSE
ndate := NEW_TIME(ndate, 'PST', 'GMT');
END IF;
RETURN ndate;
END get_GMT_date;
The funda behind the logic is Application uses the sysdate to enter the date record in XYZ oracle 10g db As per the requirement we have to convert the same date to GMT and show the same in our application.
Now to convert the date into GMT we have used the above function which is based on dbtimezone value of XYZ oracle 10g database. It also has a oracle DST patch applied.
Our assumption is to check the current time zone, if this is -7 than use the PDT in new_time function to GMT otherwise use pst for conversion.
We have tested the same in dev environment and it’s working fine for today but after November(DST over) it will work or not that’s a issue. Request any body to please confirm the logic of function.
Thanks in advance.
Edited by: 802313 on Oct 15, 2010 7:05 AM

Also Please let me know that Daylight saving Patch from oracle changes the dbtimezone value of oracle 10g db or not after DST and Before DST.

Similar Messages

  • Default value for date

    Hi experts,
    I want to set default value for dates..
    My screen has : date_from & date_to.
    date_to : will be current date(today's date) if Eg: 27.08.2007 (here i used NOW())
    then date_from must be 01.06.2007 (3 months logic)
    similarly : if date_to is 01.01.2007
    then date_from must be 01.11.2006
    kindly help...
    Thanks a lot!!!
    Regards,
    Bijal

    Hi Bijal
    (DGET(NOW(),'D'))-1) returns number which is 0 incase of 01.08.2007, so DADD(NOW(),-0,'D') is again ideally same day 01.08.2007 .
    So, DADD(DADD(NOW(),-0,'D'),-2,'M') should give you 01.06.2007.
    <b> IT WORKS!!! -
    I have tested it now.</b>
    Please check and revert.
    The IF formula which sent actually returns String, so use DVAL(IF(DGET(NOW(),'D')!=1,DADD(DADD(NOW(),-((DGET(NOW(),'D'))-1),'D'),-2,'M'),DADD(NOW(),-2,'M')))
    Message was edited by:
            Navneet Giria

  • ORA-01841 Error when value for date col is NULL in .dat (using SQL Loader)

    Hello Gurus,
    I have some data in .dat file which needs to be loaded into oracle table. I am using SQL * Loader to do the job. Although "NULLIF col_name =BLANKS" works for character datatype, but when value for date col is NULL then I get ORA-01841 error. I have to make NULL for all rows withour value for date column
    Early reply will be highly appreciated
    Farooq

    Hi,
    May be this problem is not with the NULLIF. The value for the date column is not in proper date format.
    create table:
    create table kk (empno number, ename varchar2(20), deptno number, hiredate date)
    Control file:
    LOAD DATA
    INFILE 'd:\kk\empdata.dat'
    insert into TABLE kk ( empno position (1:2) integer external,
    ename position(4:5) char NULLIF ename=BLANKS,
    deptno position (7:8) integer external NULLIF deptno=BLANKS,
    hiredate position (10:20) date NULLIF hiredate=BLANKS)
    data file:
    10 KK 01-jan-2005
    20 10
    SELECT * FROM KK;
    EMPNO ENAME DEPTNO HIREDATE
    10 KK 01-JAN-05
    20 10
    Verify the data file.
    Hope it will help

  • Set default value for date/time to previous month

    Hi All
    I have two date/time parameters in my report and I want to set the default value for both the parameters
    For start date parameter I want the first date of previous month and for end date parameter I want the last date of previous month.
    Can someone please point me to the right direction
    Thanks
    Rone

    Hi Rone,
    These links can be helpful for you:
    http://www.bidn.com/blogs/hardikabhavsar/bidn-blog/1639/default-date-parameters-in-ssrs
    http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/584a98ae-bb75-4740-9198-e6be3c1aec12/
    Regards,
    Manoj
    *Happy to help
    http://experiencingmsbi.blogspot.com/

  • Passing a value for date parameter from Oracle Forms to BIP

    Hi
    I have created a report with the following SQL query:
    select
    d_tables.d_seq,
    to_date(d_tables.d_created) creation_date,
    d_tables.d_created_by created_by,
    d_tables.d_pk,
    d_tables.table_name,
    d_tables.comments
    from
    d_tables, d_applications
    where
    d_tables.d_ppk = d_applications.d_pk
    and to_date(d_tables.d_created) >= nvl(:P_CRE_DATE_FROM, to_date(d_tables.d_created))
    and to_date(d_tables.d_created) <= nvl(:P_CRE_DATE_TO, to_date(d_tables.d_created))
    The parameters P_CRE_DATE_FROM and P_CRE_DATE_TO have been set up as date in BI Publisher with format dd-MMM-yyyy
    The report works fine when launched in BI Publisher.
    I want to call this report from Oracle Forms and I'm trying to pass the values for both the parameters. However, the report does not generate output based on values passed.
    Does it have to do with datatype? Does anyone know a solution for this?
    Kind regards,
    Aparna

    Thanks for your suggestion. I am already referring to the whitepaper and have integrated Forms with BI Publisher. The parameter passing is working fine for a varchar2 type of parameter. However, for a date type, there seems to be some problem.

  • How to use the same variable value for data entry and the planning sequence

    Hi,
    the scenario is the following:
    Using the WAD template a user enters cost center plan data. The cost center is selected by the chosen value for the variable "V1".
    Afterwards he shall push a button which starts a planning sequence (including saving the data and further functions). This planning sequence uses a filter that also contains the variable "V1".
    What or where has it to be defined that the planning sequence uses automatically the same value for the variable "V1" as selected for the data entry?

    You have to define in the planning function. The planning sequence is only a sequence and it read the planning functions underneath it.
    Ravi Thothadri

  • SQL Expression for date conversion - version XI

    I am trying to convert a number field to a date field in order to use it in a date parameter in Infoview. The database field is in a 15 digit DTM format but is stored as a number. There is also a zero stored in the database field. When I try to create the date SQL Expression I get this error: Error in compiling SQL Expression: Failed to retrieve data from the database. Details: ORA-01840: input value not long enough for date format. How can I get the SQL Expression to not look at the zero? I tried putting a statement in my Record Selection to not pull any zero fields but that doesn't work. Any ideas? Thanks! Kelley

    Hi Kelly,
    It's been a while since I used Info View, so if it's about registering, etc. I won't know the
    answer.
    Did you link it ?  Have you tested that it should even return data ? 
    Check the filtering, etc in a query builder to make sure.
    Have you tested the sub report by running it by itself ? (just add a value to the parameter
    field request)
    Do you have suppression formulas in the sub report ?
    Is the section of the main report that is holding the sub report
    free of "suppresion" formulas ?

  • Data source value for data source reportData was null

    hi i'm using struts 2 and jasperreports my problem is
    it generate a pdf file with labels but no data in it..
    and when i try to look at the logs of my sun application server
    it says Data source value for datasource reportData was null.
    reportData is an ArrayList of Personnel object.
    here is my code..
    public class EIS_HR_004_JASPER extends eisSupport {
        private String reportId;
        private String dateStart = null;
        private String dateEnd = null;
        private String pdfFile;
        private final static String _REPORT_FOLDER = "EIS_HR_003";
        private Report thisReport;
        private String dateRange;
        private ArrayList<Personnel> reportData;
        public String execute(ActionMapping mapping,ActionForm form,
                HttpServletRequest request, HttpServletResponse response)
                throws Exception {       
            ReportBean reportBean = new ReportBean();
            setThisReport(reportBean.getReport(getReportId()));         
            reportData=new ArrayList<Personnel>();
            Personnel p1=new Personnel();
            p1.setSurname("Dela Cruz");
            p1.setFirstname("Juan");
            p1.setExamcode("CSC111");
            p1.setExamdate("January 1,2003");
            Personnel p2=new Personnel();
            p2.setSurname("Cruz");
            p2.setFirstname("Miguel");
            p2.setExamcode("CSC222");
            p2.setExamdate("December 2,2003");
            reportData.add(p1);
            reportData.add(p2);
         try {
              JasperCompileManager.compileReportToFile(
                        "apps/reports/templates/hr004.jrxml",
                        "apps/reports/templates/hr004.jasper");
         } catch (Exception e) {
              e.printStackTrace();
              return ERROR;
             return SUCCESS;
        public ArrayList<Personnel> getReportData() {
           // setReportData();
            return reportData;
        here is part of my struts.xml
    <action name="EIS-HR-004_JASPER" class="eis.report.EIS_HR_004_JASPER">
                <result name="error">/apps/reports/ReportNotFound.jsp</result>
                <result name="success" type="jasper">
                    <param name="location">apps/reports/templates/hr004.jasper</param>
                    <param name="dataSource">reportData</param>
                    <param name="format">PDF</param>
                </result>
            </action> i dont know why it doesnt retrieved the data from the ArrayList?
    please help me..Thanks in advance.

    Hi,
    Looking at the code, it seems you are compiling a JRXML and that is all.
    Instead, you should fill it with data and then export the result to PDF.
    No wonder you don't see any result.
    You need to learn more about how JasperReports work. For a start, I can tell you that you could compile JRXML files as part of the application build process using an Ant task, and not dynamically, like you did. But no matter how you compile the report template, you actually need to fill it with data, using the JasperFillManager and then export it to PDF using the JasperExportManager.
    You can see all this in our samples in the /demo/samples folder that is part of our project distribution package. There is even a sample Web application in the /demo/samples/webapp folder.
    I hope this helps.
    Teodor

  • Default values for data types

    what are default values for all the data types that exist  in abap
    Title was edited by:
            Alvaro Tejada Galindo

    Hi
    For CHAR data type default is SPACE
    for INTEGER,PACK and FLOAT types it is ZERO '0'
    for NUMERIC also so many Zeros
    for Time(TIMS) it is 6 zeros and Date(DATS) it is 8 zeros
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • How to make default values for date range?

    Dear Colleagues,
    My customer is asking for a default value for a date range prompt.
    The FromDate should contain the 1st of current month, the ToDate should contain current date.
    Does anyone have any idea how I can meet this demand?
    Regards Silje

    Hi Federico,
    Thank you for the answer, we are back to the challenge after summer vacations!
    I have created a variable in the universe: SELECT current date  as TODAY FROM SYSIBM.SYSDUMMY1. I Called it TODAY.
    Then I created a prompt in the query based on Date. In Prompt Properties I tagged for "Set Default Values" and I typed in TODAY.
    When I try to run the query I get the error message:  The date for the query filter based on 'Date' is invalid (WIS10704).
    What is wrong? What do I have to do differently?
    My goal is to have a default for Date that gives me today..
    Regards Silje

  • Executing xml sql using jdbc adapter for date conversion

    Hi experts,
    I am following the fllowing blog for date format conversion for a jdbc receiver.
    /people/alessandro.berta/blog/2005/10/04/datetime-datatypes-and-oracle-database
    I constructed my graphical mapping to generate the following query
    DateField in receiver structure = TO_DATE('2008-03-24','DD-MON-YY')
    attribute hasQuot = No
    The result that i want is 24-MAR-08
    I am getting the error in communication channel monitoring as does not match string format.
    The database gets successfully updated without this date conversion. But when i try to use this, it give the above error.
    Is there any other configuration to be done to make the adapter execute this statement?
    Regards,
    Shamly

    The issue is solved.
    The SQL statement was wrong.
    The correct version is,( as was specified in the blog ) :-
    DateField in receiver structure = TO_DATE('2008-03-24','YYYY-MM-DD')
    Automatically in the database it is converted to 24-MAR-2008
    Edited by: Shamly MM on Mar 27, 2008 8:01 AM

  • Dynamic Date Value for Date Range Parameter - Scheduling in BI

    Hi,
    I am New to BO Enterprise XI R3. I want to schedule the Crystal report which takes Date Range as parameter. Is any option available to calculate From Date automatically based on Current Date based on the range required?
    Currently, Parameter option accepts parameters and enterprise process the report for configured parameters. In this case, report always prints only for configured date range eventhough report generated after one month. I am expecting report has to print data for date range (eg. 1 weeks, 4 days, or any range) based on system current date.
    Thanks in Advance,
    Venkateswaran.P

    I'm am in the same situation.  I need to be able to have the date parameter dynamically change based on the current day's date when I schedule a report.  However, because this parameter comes from a Stored Procedure from the database, it cannot be modified in the Report Designer (as far as I know).  I've tried to set a default for it to use "currentdate" but it doesn't seem to take.  Anyone know if this can be accomplished in the scheduler?
    Thanks
    -Tom

  • Formula is showing wrong values for dates

    Hi i have document date and clear date
    number of days is clear date -doc date
    my doc date : 10/28/2008
    my clear date : 11/24/2008
    i have create 2 formula variabes ( at columns i want bring my characters)
    nexti have written formula ( variable for clear date- variable for doc date)
    but this variable are shwoing data format like
    c1 (variable for clear date)  : 20,081,124
    c2 ( variable for doc date) : 20,081,028
    formula c1-c2 is shwoing 96 days actaully  original date format (11/24/2008-10/28/2008) i will get less than 30 days.
    please let me know how to solve this issues

    Hi Suneel,
    I m giving you the detailed steps here so as to clear any doubts...
    1. In the new formula window right click on Formula Variable and choose New Variable
    2. Enter the Variable Name, Description and select Replacement Path in the Processing by field.
    Click the Next Button
    3. In the Characteristic screen, select the date characteristic that represents the first date to use in the calculation
    4. In the Replacement Path screen select Key in the Replace Variable with field. Leave all the other options as they are (The offset values will be set automatically).
    5. In the Currencies and Units screen select Date as the Dimension ID
    Repeat the same steps to create a formula variable for second date and use them in the calculation.
    Follow these steps and your problem will be solved for sure.
    Regards,
    Yogesh

  • Function Module for DATE Conversion

    Hi All,
    I need some help to know a function module to get the exact date in a year.
    If i give the no. of days and the year.. it has to give me the exact date.
    for eg: if no. of days are 90 and the year is 2006 the output should be 31st MARCH 2006. Like that if i enter any number (< 364 or 363) and the year it has to tell me the date of the count of no.of days.
    Thank You,
    Suresh

    Hi Suresh,
    You can use FM HR_SEN_CALE_DAYS_DATE.
    Here you can pass '01.01.2006' , operator as '+' and in
    IS_DURATION enter the number of days under 'CALDD'.
    For eg:
    Test for function group      HRSEN00CRULE_CALE_DAYS                              
    Function module              HR_SEN_CALE_DAYS_DATE                               
    Import parameters                                                                               
    ID_DATE                         01.01.2006  
      ID_OPERATOR                     +             
      IS_DURATION                         0.0000     0.0000       30.0000                                                                               
    Export parameters               Value                                                                               
    ED_DATE                         30.01.2006                                                                               
    Regards,
    Raj

  • Need to raise an error if Users puts wrong value for date datatype in Forms

    Hi all,
    I've created a new form using Template.fmb in forms 10g having some text item with data type as DATE.
    and now i wanted to raise an error if users inputs any wrong data rather than DATE format.
    Please help me if anyone knows how to do this...

    b_kapsy wrote:
    As of now i am not looking for validation, i know the validation will automatically done but if you see by default it will not raise any error message if you fill any wrong value in text item with date data type. It will freeze the cursor to the text item.That is NOT the default. The default is to issue various FRM-nnnnn messages, between 50002 and 50026. From notes I have:
    -- 50002: Month must be between 1 and 12.
    -- 50003: Year must be 00-99 or 1000-4712
    -- 50004: Day must be between 1 and last of month.
    -- 50012: Date must be entered in a format like <fxMMDDRR>
    -- 50017,18,19: Hour,Min,Sec must be between 0 and 23,59,59.
    -- 50025: Date/time must be entered in a format like <xxyytttt>
    -- 50026: same as 50012 and 50025 with <yyyy> year.
    And from my old, dusty copy of the Oracle Developer/2000 "Messages and Codes Manual", those messages have an error level = 15.
    If you are not seeing those messages, then you have done one of two things:
    1. Set your System.Message_Level to a value of 15 or higher. You should NEVER set it above zero, since all that does is hides error messages like these. If you want to bypass or prevent an error message, it should be handled in the Re: FRM-40735:Pre_Insert trigger raised unhandled exception ORA-20011.
    2. You have some bad code in an On-Error trigger that fails to handle errors correctly.

Maybe you are looking for

  • External display is sideways

    i just installed xp on my MB and every time i connect an external display it is sideways. i was wondering if there was a way to change that since everything that i have tried hasnt worked?

  • Adjusting the Local Layout (GUI settings) from abap

    Hi, Is is possible to adjust the local layout (GUI settings) from abap program? Ex. Local layout --> options --> cursor settings --> (cursor position) Automatic TAB at Field End Kind regards, Keld Gregersen

  • Citi AA Executive

    CreditCuriousity wrote: Irish80 wrote: CreditCuriousity wrote: Wow Congrats Irish!  Alot of spend, but you have alot of AA miles now don't you?  How many do you have if you don't mind me asking.. Assuminig the ones from this offer are included?  200k

  • Couldn't connect to store. Network connection timed out.

    I can't connect to the iTunes store. I never have been able to. The error message reads, "iTunes could not connect to the iTunes store. The network connection timed out." I have adjusted and disabled Windows and Norton firewalls, I have reconfigured

  • DB2 9.1 support

    Hi, Can someone tell me when kodo support for DB2 9.1 will be added? Thanks, Jim http://edocs.bea.com/kodo/docs41/supp_configs/supp_configs.html