Help on Date format

Hello,
My query is:
SELECT TO_CHAR((SYSDATE -2) , 'Dy Mon DD')
FROM dual;
Which produces:
Wed Feb 09
Since I want to grep Oracle's log where the date must be Wed Feb 9 (between Month and date I need two spaces)
But when the date is Fri Feb 11 I need one space.
How can I do that?
Can I use case ?
Thank you

Hi,
Interesting problem!
You could get the output with two digits, and then change the leading 0 (if there is one) to a space, like this:
SELECT     REPLACE ( TO_CHAR ( SYSDATE - 2
                 , 'Dy Mon DD'
          , ' 0'
          )          AS anteayer
FROM     dual;Does your grep tool allow you to use regular expressions, or anything like that?
If Oracle, you could say:
WHERE     REGEXP_LIKE ( date_string
              , 'Wed Feb  +9'
              )and it wouldn't matter if there were 1 or 2 spaces after the month.

Similar Messages

  • Pls Help with date format picture ends ......error

    Hi Everyone,
       I am getting the following error when I run my crystal report.
    Failed to retrieve data from the database.
    Details: HY000:[DataDirect][ODBC Oracle driver][Oracle]ORA-01830: date format picture ends before converting entire input string
    [Database Vendor Code: 1830]
       I am using SQL Command for my report and in the command  my date fields are of "Date" datatype.
       I am using Crystal Reports XI R2,driver - CR Oracle ODBC Driver 5.1
       Any help is greatly appreciated.
    Thanks in advance
    My SQL Command is as follows:
    <
    with MAXNEWSTAT as
    (select
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE,
    MAX(HRHISTORY.ACT_OBJ_ID) ACT_OBJ_ID
    FROM
    LAWSON.HRHISTORY
    WHERE
    HRHISTORY.FLD_NBR=20
    and TO_DATE(HRHISTORY.DATE_STAMP)
        >= TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,-1)),'YYYY/MM')||'/01'),'YYYY/MM/DD') 
        AND  TO_DATE(HRHISTORY.DATE_STAMP) <= (TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,0)),'YYYY/MM')||'/01'),'YYYY/MM/DD'))-1
    /--Added by HAN--/
        GROUP BY COMPANY,
        EMPLOYEE),
    NEWSTAT AS
    (SELECT
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE,
    HRHISTORY.A_VALUE,
    HRHISTORY.DATE_STAMP,
    HRHISTORY.BEG_DATE,
    HRHISTORY.ACT_OBJ_ID NS_OBJ_ID,
    HRHISTORY.SEQ_NBR
    FROM
    LAWSON.HRHISTORY
    INNER JOIN LAWSON.MAXNEWSTAT
    ON
    /--Added by HAN--/
    HRHISTORY.COMPANY = MAXNEWSTAT.COMPANY
    /--Added by KAM--/
    AND HRHISTORY.EMPLOYEE = MAXNEWSTAT.EMPLOYEE
    AND HRHISTORY.ACT_OBJ_ID = MAXNEWSTAT.ACT_OBJ_ID
    WHERE
    HRHISTORY.FLD_NBR=20
    and TO_DATE(HRHISTORY.DATE_STAMP)
        >= TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,-1)),'YYYY/MM')||'/01'),'YYYY/MM/DD') 
        AND  TO_DATE(HRHISTORY.DATE_STAMP) <= (TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,0)),'YYYY/MM')||'/01'),'YYYY/MM/DD'))-1
    PREVSTATID AS
    (SELECT
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE,
    MAX(HRHISTORY.ACT_OBJ_ID)OBJ_ID
    FROM
    LAWSON.HRHISTORY
        INNER JOIN LAWSON.NEWSTAT
    /--Added by HAN--/
        ON HRHISTORY.COMPANY = NEWSTAT.COMPANY
        AND HRHISTORY.EMPLOYEE = NEWSTAT.EMPLOYEE
    WHERE
    HRHISTORY.FLD_NBR=20
    AND TO_DATE(HRHISTORY.BEG_DATE)
    < to_date(NEWSTAT.BEG_DATE)
    GROUP BY
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE
    PREVSTAT AS
    (SELECT
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE,
    HRHISTORY.A_VALUE A_VALUE,
    HRHISTORY.DATE_STAMP DATE_STAMP,
    HRHISTORY.BEG_DATE BEG_DATE,
    HRHISTORY.ACT_OBJ_ID OBJ_ID,
    HRHISTORY.SEQ_NBR SEQ_NBR
    FROM
    LAWSON.HRHISTORY
        INNER JOIN LAWSON.PREVSTATID
    /--Added by HAN--/
        ON HRHISTORY.COMPANY = PREVSTATID.COMPANY
        AND HRHISTORY.EMPLOYEE = PREVSTATID.EMPLOYEE
    WHERE
    HRHISTORY.FLD_NBR=20 AND
    HRHISTORY.ACT_OBJ_ID = PREVSTATID.OBJ_ID
    MAXPERSACTHST AS
    (SELECT
    PERSACTHST.EMPLOYEE,
    /--Added by KAM--/
    PERSACTHST.COMPANY,
    MAX(PERSACTHST.DATE_STAMP)DATE_STAMP
    FROM
    LAWSON.PERSACTHST
    WHERE
    (PERSACTHST.ACTION_CODE='LOASTATUS' OR PERSACTHST.ACTION_CODE='STATUS')
    AND TO_DATE(PERSACTHST.DATE_STAMP)
        >= TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,-1)),'YYYY/MM')||'/01'),'YYYY/MM/DD') 
        AND  TO_DATE(PERSACTHST.DATE_STAMP) <= (TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,0)),'YYYY/MM')||'/01'),'YYYY/MM/DD'))-1
    GROUP BY PERSACTHST.EMPLOYEE,
    /--Added by KAM--/
    PERSACTHST.COMPANY
    CHANGELIST AS   
    (SELECT
    PERSACTHST.EMPLOYEE,
    /--Added by KAM--/
    PERSACTHST.COMPANY,
    PERSACTHST.ACTION_CODE,
    PERSACTHST.REASON_01,
    PERSACTHST.DATE_STAMP,
    PERSACTHST.EFFECT_DATE,
    PERSACTHST.REASON_02,
    PREVSTAT.A_VALUE PS_A_VALUE,
    PREVSTAT.DATE_STAMP PS_HR_DATE_STAMP,
    PREVSTAT.BEG_DATE PS_HR_BEG_DATE,
    PREVSTAT.OBJ_ID PS_HR_OBJ_ID,
    PREVSTAT.SEQ_NBR PS_HR_SEQ_ID,
    NEWSTAT.A_VALUE NS_A_VALUE,
    NEWSTAT.DATE_STAMP NS_DATE_STAMP,
    NEWSTAT.BEG_DATE NS_BEG_DATE,
    NEWSTAT.NS_OBJ_ID,
    NEWSTAT.SEQ_NBR NS_SEQ_NBR
    FROM
    LAWSON.PERSACTHST PERSACTHST
                        INNER JOIN LAWSON.PREVSTAT
                       ON PERSACTHST.EMPLOYEE=PREVSTAT.EMPLOYEE
                       /--Added by KAM--/
                       AND PERSACTHST.COMPANY = PREVSTAT.COMPANY
                       INNER JOIN LAWSON.NEWSTAT
                       ON PERSACTHST.EMPLOYEE = NEWSTAT.EMPLOYEE
                      /--Added by KAM--/
                       AND PERSACTHST.COMPANY = NEWSTAT.COMPANY
                       INNER JOIN LAWSON.MAXPERSACTHST
                       ON PERSACTHST.EMPLOYEE = MAXPERSACTHST.EMPLOYEE
                      /--Added by KAM--/
                         AND PERSACTHST.COMPANY = MAXPERSACTHST.COMPANY
    WHERE
    (PERSACTHST.ACTION_CODE='LOASTATUS' OR PERSACTHST.ACTION_CODE='STATUS')
    AND NEWSTAT.A_VALUE <> PREVSTAT.A_VALUE
    AND MAXPERSACTHST.DATE_STAMP = PERSACTHST.DATE_STAMP
    PAEMPPOSENDDATE AS
    (SELECT
      PAEMPPOS.EMPLOYEE,
      PAEMPPOS.COMPANY,
      CASE
      WHEN PAEMPPOS.END_DATE = TO_DATE('1700,01,01','YYYY,MM,DD')
             THEN to_date(SYSDATE + 1,'YYYY,MM,DD')
           ELSE PAEMPPOS.END_DATE 
      END END_DATE,
      PAEMPPOS.EFFECT_DATE
      FROM LAWSON.PAEMPPOS),
    CURRFTE AS
    (SELECT
      PAEMPPOS.EMPLOYEE,
    /--Added by KAM--/
      PAEMPPOS.COMPANY,
      PAEMPPOS.FTE CURR_FTE,
      PAEMPPOS.EFFECT_DATE,
      PAEMPPOSENDDATE.END_DATE  
    FROM
    LAWSON.PAEMPPOS
    INNER JOIN LAWSON.NEWSTAT
    ON (PAEMPPOS.EMPLOYEE = NEWSTAT.EMPLOYEE)
    /--Added by KAM--/
    AND (PAEMPPOS.COMPANY = NEWSTAT.COMPANY)
    INNER JOIN LAWSON.PAEMPPOSENDDATE
    ON PAEMPPOS.EMPLOYEE = PAEMPPOSENDDATE.EMPLOYEE
    /--Added by KAM--/
    AND PAEMPPOS.COMPANY = PAEMPPOSENDDATE.COMPANY
    AND PAEMPPOS.EFFECT_DATE=PAEMPPOSENDDATE.EFFECT_DATE
    WHERE
      (PAEMPPOSENDDATE.EFFECT_DATE <= NEWSTAT.BEG_DATE AND PAEMPPOSENDDATE.END_DATE >= NEWSTAT.BEG_DATE)
    PREVFTE AS
    (SELECT
      PAEMPPOS.EMPLOYEE,
    /--Added by KAM--/
      PAEMPPOS.COMPANY,
      PAEMPPOS.FTE PREV_FTE,
    PAEMPPOSENDDATE.END_DATE 
    FROM
    LAWSON.PAEMPPOS
    INNER JOIN LAWSON.NEWSTAT
    ON (PAEMPPOS.EMPLOYEE = NEWSTAT.EMPLOYEE)
    /--Added by KAM--/
    AND (PAEMPPOS.COMPANY = NEWSTAT.EMPLOYEE)
    INNER JOIN LAWSON.PAEMPPOSENDDATE
    ON (PAEMPPOS.EMPLOYEE = PAEMPPOSENDDATE.EMPLOYEE)
    /--Added by KAM--/
    AND (PAEMPPOS.COMPANY = PAEMPPOSENDDATE.COMPANY)
    AND (PAEMPPOS.EFFECT_DATE = PAEMPPOSENDDATE.EFFECT_DATE)
    WHERE
      PAEMPPOS.EFFECT_DATE <= (NEWSTAT.BEG_DATE-1)AND  PAEMPPOSENDDATE.END_DATE >= (NEWSTAT.BEG_DATE -1)
    SELECT DISTINCT
    EMPLOYEE.EMPLOYEE,
    EMPLOYEE.DEPARTMENT,
    EMPLOYEE.PROCESS_LEVEL,
    EMPLOYEE.EMP_STATUS,
    EMPLOYEE.FIRST_NAME,
    EMPLOYEE.LAST_NAME,
    EMPLOYEE.MIDDLE_INIT,
    EMPLOYEE.POSITION,
    PAPOSITION.DESCRIPTION,
    CHANGELIST.PS_A_VALUE,
    /--Added by KAM--/
    CHANGELIST.COMPANY,
    CHANGELIST.PS_HR_DATE_STAMP,
    CHANGELIST.PS_HR_BEG_DATE,
    CHANGELIST.PS_HR_OBJ_ID,
    CHANGELIST.NS_A_VALUE,
    CHANGELIST.NS_DATE_STAMP,
    CHANGELIST.NS_OBJ_ID,
    CHANGELIST.ACTION_CODE,
    CHANGELIST.REASON_01,
    CHANGELIST.REASON_02,
    CHANGELIST.DATE_STAMP PERSACTSDATESTAMP,
    CHANGELIST.EFFECT_DATE PERSACTEFFDATE,
    DEPTCODE.R_NAME DEPTNAME,
    PRSYSTEM.R_NAME PLNAME,
    PREVFTE.PREV_FTE,
    CURRFTE.CURR_FTE,
    CHANGELIST.NS_BEG_DATE,
    PGSELECT.GROUP_NAME,
    PAEMPLOYEE.SENIOR_DATE
    FROM
    LAWSON.CHANGELIST
                      INNER JOIN LAWSON.EMPLOYEE
                     ON (EMPLOYEE.EMPLOYEE = CHANGELIST.EMPLOYEE)
    /--Added by KAM--/
                     AND (EMPLOYEE.COMPANY = CHANGELIST.COMPANY)
                     INNER JOIN LAWSON.DEPTCODE
                     ON ((EMPLOYEE.COMPANY=DEPTCODE.COMPANY)
                     AND (EMPLOYEE.PROCESS_LEVEL=DEPTCODE.PROCESS_LEVEL)
                     AND (EMPLOYEE.DEPARTMENT=DEPTCODE.DEPARTMENT))
                     INNER JOIN LAWSON.PRSYSTEM
                     ON ((EMPLOYEE.COMPANY=PRSYSTEM.COMPANY)
                     AND(EMPLOYEE.PROCESS_LEVEL=PRSYSTEM.PROCESS_LEVEL))
                     LEFT OUTER JOIN LAWSON.PREVFTE
                       ON (CHANGELIST.EMPLOYEE=PREVFTE.EMPLOYEE)
    /--Added by KAM--/                
                     AND (CHANGELIST.COMPANY=PREVFTE.COMPANY)
                     LEFT OUTER JOIN LAWSON.CURRFTE
                     ON (CHANGELIST.EMPLOYEE=CURRFTE.EMPLOYEE)
    /--Added by KAM--/                                
                     AND (CHANGELIST.COMPANY=CURRFTE.COMPANY)
                     INNER JOIN LAWSON.PGSELECT PGSELECT
                       ON ((EMPLOYEE.COMPANY=PGSELECT.COMPANY)
                     AND (EMPLOYEE.EMP_STATUS=PGSELECT.BEGIN_VALUE))
                     LEFT OUTER JOIN LAWSON.PAPOSITION
                     ON (EMPLOYEE.POSITION=PAPOSITION.POSITION)
                     AND (EMPLOYEE.COMPANY=PAPOSITION.COMPANY)
                     INNER JOIN LAWSON.PAEMPLOYEE
                     ON (CHANGELIST.EMPLOYEE=PAEMPLOYEE.EMPLOYEE)
    /--Added by KAM--/               
                    AND (CHANGELIST.COMPANY=PAEMPLOYEE.COMPANY)
    WHERE
    (PGSELECT.GROUP_NAME='G:ACTIVE' OR PGSELECT.GROUP_NAME='G:INACTIVE')
    >

    Hi Arsh,
    The error message you receive i.e.
    ORA-01830: date format picture ends before converting entire input string
    is an Oracle error.
    The following document would be helpful:
    ORA-01830:     date format picture ends before converting entire input string
    Cause:     A valid date format picture included extra data. The first part of the format picture was converted into a valid date, but the remaining data was not required.
    Action:     Check the specifications for date format pictures and correct the statement.
    Regards,
    Alpana

  • Help by date format in UIX/XML

    In UIX/XML I would like to indicate the date fields in the format to 'DD.MM.YYYY '. I modify the properties of my view object and entity object in the window "structure window". It does not change view for anything.
    What wrong do I make?
    Who can help me please !!!!

    Please post what version of JDeveloper you are using. Also post a small sample application that shows what you are trying to do.
    I am not sure what you mean. Are you trying to display a date from the database, or have the user enter a date?
    The date format is determined from the client browser locale. It will default to the US date format mm/dd/yy unless the browser locale is overridden.
    If you want the user to enter a date, you should be using <dateField>. This will also expect mm/dd/yy unless you override it with a validater. Please refer to the UIX Element Reference. This documents <dateField>. The <onSubmitValidater> is a child of <dateField>, it is also documented in the Element Reference. <date> is the validater you want, it is a child of <onSubmitValidater>. You can specify a validation pattern.

  • Create unique Form ID - Help on Date Format in Concat

    I am having problems formating a date value in my concat statement.  I have tried to write is different ways and still can't seem to get the string correct.
    Ideally, I would like to change the date value to a Julian value for the form ID, but I would settle for just mmddyy value without the / or - in between.
    Codes I have tried w/out date format string
    JavaScript - Calculate
    Program.FormID.rawValue=Program.State.rawValue + Program.ProgramNumber.rawValue + Program.ProgramDate.formattedValue;
    Returns - MO1234Jul8,2010  
    -------------And--------------------
    Program.FormID.rawValue=Program.State.rawValue + Program.ProgramNumber.rawValue + Program.ProgramDate.rawValue;
    Returns - MO12342010-07-08
    FormCalc - Calculate 
    (This one has the current date as a value, but it changes the unique form ID when reopened on another day, that is why I am using ProgramDate)
    Concat(Date2Num(Date(), "ddmmyyy"),Program.State.rawValue, Program.ProgramNumber.rawValue)
    Returns - 0MO1234
    ----------- And --------------------
    if 
    (Program.ProgramNumber.rawValue ne null) then
    $.rawValue
    = CONCAT(Program.State.rawValue, Program.ProgramNumber.rawValue, Program.ProgramDate.formattedValue)
    else
    $.rawValue = ""
    endif 
    Returns - MO1234July8,2010  (formattedValue)
                  MO12342010-07-08 (rawValue)
    What would be the better  language to use, FormCalc or JavaScript for this example?
    I am not all that skilled at coding and use forums like this to help me, so I appreciate any help.
    Thanks in advance - Eve

    Date.prototype.yyyymmdd = function() {
       var yyyy = this.getFullYear().toString();
       var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
       var dd  = this.getDate().toString();
       return yyyy + (mm[1]?mm:"0"+mm[0]) + (dd[1]?dd:"0"+dd[0]); // padding
    Now, after having spliced the internal Date object, you can do this:
    d = new Date();
    d.yyyymmdd();
    The line above returns today's date: "20100709".

  • Help in date format for transaction F-01

    Hello Experts,
    I am currently modifying a report wherein it posts document using
    transaction F-01. Now, I am getting an error wherein it says:
    Direct input date: Date 04162007 is incorrect. The document has not
    been created.
    Now, how can I modify it in such a way that whatever format of the date is,
    it will be correctly translated to the proper format for F-01. For example,
    in my selection screen i enter it as 16.04.2007 and other users enter it as
    04/16/2007. Hope you can help me out here guys. Thank you and take care!

    Hai,
    You can enter any date format.
    But you have to validate the date format.
    The date format depends on the settings.
    The format code can be known by the <b>USR01</b> with <b>DATFM</b> field.
    So<b> select</b> that field value.
    <b>Depending</b> on that type(1 to 6)
    write your conversion code like:
    Case date_code.
      when 1.
         do convwersion here.  
      when 2.
    when 6.
         do convwersion here
    endcase.
    Hope now you can do with any date format.
    <b>Reward points if it helps you.</b>
    Regds,
    Rama chary.Pammi

  • Need help with date format mask

    Hi there, right now I'm trying to set a default date format mask constraint for one of the attributes for my table. I want to set the default mask constraint as MM/DD/YY but I don't know how to. it should be something like:
    CREATE TABLE work (WorkDate DATE CHECK (WorkDate = 'MM/DD/YY'))
    or something like that, but I don't think that's correct. Can anyone help me? Thanks in advance.

    What you want (and should have done) is to read the documentation, starting with the concepts:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#CNCPT413
    http://www.oracle.com/pls/db102/search?remark=quick_search&word=date&tab_id=&format=ranked
    A date is stored as, well, a date, format masks only come into play when you're selecting/retrieving a date or when you want to store a string as a date. Default date formats can be set through NLS_DATE_FORMAT at session and database level.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams122.htm#REFRN10119
    Documentation homes (from which you can do a simple quick search):
    http://www.oracle.com/pls/db102/homepage
    http://www.oracle.com/pls/db112/homepage
    Bottom line:
    Trying to set a default date format mask on a date datatype column makes no sense...

  • Helps on date format

    Hi all,
    I got the column in table A where the date format is dd/mm/yyyy ( 01/03/2005), and another table B where the date format is dd/mm/yyyy HH24:MI:SS. So in order to let the two table to talk to each other, I hv the following query
    B.transaction_date >= TO_DATE(A.start_date , 'DD-MON-RRRR HH24:MI:SS')
    B.transaction_date <= TO_DATE(A.end_date, 'DD-MON-RRRR HH24:MI:SS')
    I hv problem with the end result b'cos of the date format in table A is dd/mm/yyyy whereas the transaction_date in table B has the format with time. How can I format or convert the date in the table B to be in defaulted time such as A.start_date 00:00:00 and b.end_date 23:59:59 ??
    How to format this ? please helps. Thanks
    Rgds
    Lim

    Hello
    Are the transaction_date, start_date and end_date columns all DATE data types?
    If so, all DATE columns have the time component but it may be truncated i.e. set to 00:00:00. To do a date range in your case you could do something like:
         B.transaction_date >= A.start_date
    AND
         B.transaction_date < A.end_date + 1By using this construct you are forming a range between today at midnight and tonight at 23:59:59, so you don't have to worry about setting the time component on your end_date.
    HTH

  • Help with date format

    Hi, I have a record update form that shows Start date and End date in 2 separate fields like dd/mm/yyyy. When I edit the dates they do not get to the database correctly, all I get is 0000/00/00. I guess this is because the date format accepted by MySQL is yyyy/mm/dd.
    I'm stuck because I don't know how to convert the dates back to MySQL format for updating.
    This is the code that displays the start date:
    //<input name="AG_fechai" type="text" class="CP_loginFormFields" value="<?php echo date('d/m/Y',strtotime($row_eventosUpdate_RS['AG_fechai'])); ?>" size="32" />
    This is the code that displays the end date:
    //<input name="AG_fechaf" type="text" class="CP_loginFormFields" value="<?php echo date('d/m/Y',strtotime($row_eventosUpdate_RS['AG_fechaf'])); ?>" size="32" />
    This is my update query.(AG_fechai and AG_fechaf are the start and end date fields) which are not been updated. I appreciate your help. Thanks.
    // $updateSQL = sprintf("UPDATE t_agenda SET AG_fechai=%s, AG_fechaf=%s, AG_precio=%s, AG_horario=%s, AG_titulo_esp=%s, AG_titulo_eng=%s, AG_titulo_ger=%s, AG_titulo_fra=%s WHERE id_AG=%s",
    GetSQLValueString($_POST['AG_fechai'], "date",
    GetSQLValueString($_POST['AG_fechaf'], "date",
    GetSQLValueString($_POST['AG_precio'], "text",
    GetSQLValueString($_POST['AG_horario'], "text",
    GetSQLValueString($_POST['AG_titulo_esp'], "text",
    GetSQLValueString($_POST['AG_titulo_eng'], "text",
    GetSQLValueString($_POST['AG_titulo_ger'], "text",
    GetSQLValueString($_POST['AG_titulo_fra'], "text",
    GetSQLValueString($_POST['id_AG'], "int");
    mysql_select_db($database_amat_connect, $amat_connect);
    $Result1 = mysql_query($updateSQL, $amat_connect) or die(mysql_error());

    MySQL stores dates in one format only: the ISO recommended YYYY-MM-DD. You need to reorder the date parts to store the date correctly.
    If your input date is in the following format: dd/mm/yyyy, you can convert it by creating a custom function like this:
    function convertDate($val) {
      $parts = explode('/', $val);
      return "$parts[2]-$parts[1]-$parts[0]";
    Pass both dates to this function:
    GetSQLValueString(convertDate($_POST['AG_fechai']), "date",
    GetSQLValueString(convertDate($_POST['AG_fechaf']), "date",

  • Help with date formatting.

    Hi,
    I have been asked to fix a problem with a report. I have found that the problem is the date format being passed to the stored procedure is not correct, The current format is like Mon April 04 2007. The correct format should be DD-MMM-YYYY which I take to be Mon Apr 04 2004. I am not sure if this is correct anyway, but after looking at the code and the api I have managed to create a date object and call toString on it, after setting a simple date format to dd MMM yyyy.
    The problem is that the toString method returns Mon Apr 02 00:00:00 BST 20
    07. Is anybody able to help me with this? Below is a little bit of the code:
    public void renderDailyReport(ServletWriter out, HttpServletRequest request) throws Exception {
            // reset counters
            totalHits    = 0;
            maxHits      = 0;
            minHits      = 0;
            // get a GregorianCalendar object using the startDate and endDate Strings
            SimpleDateFormat  sdf         = new SimpleDateFormat("dd MMMM yyyy", Locale.UK);
            SimpleDateFormat procedureDateFormat = new SimpleDateFormat("dd MMM yyyy", Locale.UK);
            GregorianCalendar dateCounter = new GregorianCalendar();
            GregorianCalendar upperLimit  = new GregorianCalendar();
            sdf.setCalendar(Calendar.getInstance());
            Date sd = sdf.parse(startDate);
            Date ed = sdf.parse(endDate);
            procStartDate = procedureDateFormat.parse(startDate);
            procEndDate = procedureDateFormat.parse(endDate);The procStart and end dates are the bits that I added.
    They are passed to the stored procedure calling .toString, they are date objects.
    Appreciate any help.

    Do not use the toString() method of Date - it will always be the same format.
    Use the format() method of SimpleDateFormat.
    Date d = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("'dd-MMM-yyyy"); // or something like this
    String s = sdf.format(d);Message was edited by:
    jbish

  • Required help with date format

    Hi All,
    I am calling a webservice from plsql, for this I am using UTL_DBWS package. I want to insert the format of date as 'YYYY-MM-DD' only. I used to_char(sysdate, 'YYYY-MM-DD') , but it is throwing error. Please suggest any solution.
    Thanks and Regards,
    Mahesh
    The error details are as follows
    ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException
    Caught exception while handling request: invalid date: 25-NOV-08
    ORA-06512: at "SYS.UTL_DBWS", line 403
    ORA-06512: at "SYS.UTL_DBWS", line 400

    user6391695 wrote:
    Hi All,
    I am calling a webservice from plsql, for this I am using UTL_DBWS package. I want to insert the format of date as 'YYYY-MM-DD' only. I used to_char(sysdate, 'YYYY-MM-DD') , but it is throwing error. Please suggest any solution.What happens is...
    You convert sysdate into a string of the format YYYY-MM-DD and then you are passing that to a parameter that is a DATE datatype. When you do this oracle has to implicitly conver the string to the DATE datatype. It does this based on the NLS settings of the session which, I would guess, are not of the format YYYY-MM-DD, so it can't understand the string you have passed and fails to convert it to a date.
    Date formats are not something that is stored on the database (assuming you are correctly storing dates as DATE datatype). The format of dates is a display issue and something that should be handled by the user interface. The database stores data, just that, no display formats. ;)

  • Help with date format and sql

    Hi
    I am a complete oracle idiot.
    I have created a table with 2 columns po_id,po_date. Yhe id data type is number,date type is date. To add values to the table i enter something like
    "insert into purchase_orders(po_id,po_date) values(1,01/01/2004)"
    It does not accept the date and will not add the record, i have also tried the date format 01-Jan-2004.
    What is the proper way to add the date.
    Thanks
    Garry

    You probably want to use an explicit to_date cast. That lets you specify the format of the date string, i.e.
    INSERT INTO purchase_orders( po_id, po_date )
      VALUES( 1, to_date( '01/01/2004', 'DD/MM/YYYY' );Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Help :  Simple Date Formats Problem in JDev11 [TP4] ?

    Hi ;
    I use ADF/JSF in JDeveloper 11 [TP4].
    in JSF Page
    what can I do to enter Date format mask dd-mm-yyyy hh:mi:ss
    to Return my Date Format mask like
    mi-mm-yyyy meaning minute-month-year
    in another column ?
    and I know The format mask is defined in a File called formatinfo.xml .
    Thanks & Regards
    Forakora

    Hi,
    if it is for display then you don't need to change it in the model but can link the output text component to a managed bean that gets the stored date value to then change it to the format you prefer. This however may not be suitable if the date should be updated from that column

  • Need help at date format while creating External Tables from Flat file

    Hi All,
    I have a flat file generated from SQL Server 2005. In that generated flat file the date format is in the format as "YYYY-MM-DD HH24:MI:SS.Millisec" like example "2007-09-08 13:32:36.568".
    My task is I have to load this flat file data into Oracle database table running on 9i, but its failing at the creation of external table itself because of this date format. The target table in Oracle the date column data type is "date" only not the "TIMESTAMP".
    Can any body suggest how to resolve this?
    Thanks,
    Sankar

    Or:
    SQL> select cast(to_timestamp('2007-09-08 13:32:36.568',
      2                  'yyyy-mm-dd hh24:mi:ss.xff') as  date) dt
      3  from dual;
    DT
    08-SEP-07                                                                                                                                                                                                                                                                                                                                                                   

  • Help in date format in dashboard

    Hi All:
    I am using dashboard prompt for filteration on date. I want default initialization in 'dd-mm-yyyy'. I successfully done it. But when I use calendar then its format is "mm/d/yyyy'. Is it possible to change the format of calendar date in 'dd-mm-yyyy' Pluzz help me in this context.
    Thanks
    Haroon

    Hello Ali,
    please let me know, if you have an solution :-)
    I figured out, that when you change the country / language, the format will change.
    Perhaps this help you.
    Regards,
    Stefan

  • Need Help on Date Format in Apps

    Hi,
    I am getting error message ORA-01861:literal does not match format string.
    My concurrent program has 5 parameters. one of this is Date datatype. I have attached FND_STANDARD_DATE value set for that parameter.
    when i submit the concurrent program, i am getting the above error.
    I wrote like this query in cursor declaration
    SELECT * FROM <TABLE>
    WHERE <COLUMN.DATE datatype,'DD/MM/YYYY'>(Retieving Database) = <PARAMETER.DATE.datatype,'RRRR/MM/DD'>(this is fnd_standard_date)
    Please any one guide me to solve above qurery.
    Thanks in advance

    hi
    i have similar to above thing
    i solved when i have to pass date value to pl/sql procedure that is in fnd_standard_date (yyyy/mm/dd hh24mi ss) format vice versa now i want to pass value from
    program paramter form value type as sql statment and default value as select func(sysdate) from dual
    i want to know that sysdate is what format is it same fnd_standard_date (but i tried it is showning APP-FND-01564: ORACLE error 904 in FDFGDF)
    i tried lot of thing no solution
    please help me
    in this regard
    thankd in advance ....

  • Need help in date formatting

    Hi,
    I need to print date in the following format:
    Jan 21, 2007
    11:23 AM 21/01/2007
    21-01-2007 18:23
    Now as per condition of assignment the year, month, day and hour, min, sec all are entered as separate integer values.
    my code:
    import java.util.*;
    import java.text.*;
    public class stringToDate
    // Integer value of date and time variables
    int day=21;
    int month = 1;
    int year=07;
    int hour=18;
    int min=23;
    int sec=14;
    // Converting integer value into date
    public void convertIntoDate()
         String strTmp= day+"/"+month+"/"+year+" "+hour+":"+min+":"+sec;
         System.out.println("String: " + strTmp);
         DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
         try
              Date outDate = dateFormat.parse(strTmp);
              System.out.println("Converted: " + dateFormat.format(outDate));
         catch(Exception e){ System.out.println("Exception: " + e);}
    public static void main(String args[]) {
         stringToDate dF = new stringToDate();
         dF.convertIntoDate();
    }Now as per my code i am able to print in the following format:
    String: 21/1/7 18:23:14
    Converted: 21/01/0007 18:23:14
    But if i try to print in other formats it gives me following error message:
    Exception: java.text.ParseException: Unparseable date: "21/1/07"
    Please help me....

    vinee wrote:
    Hi,
    I tried different output format but still i'm facing the same issue
    Following the complete code and error message....
    import java.util.*;
    import java.text.*;
    public class stringToDate
    // Integer value of date and time variables
    int day=21;
    int month = 1;
    int year=07;
    int hour=18;
    int min=23;
    int sec=14;
    // Converting integer value into date
    public void convertIntoDate()
    DateFormat dateFormat;
    Date outDate=null;
    String strTmp= day+"/"+month+"/"+year+" "+hour+":"+min+":"+sec;
    System.out.println("Entered string for date: " + strTmp);
         // Format 01/01/0070 15:24:14
         dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
         try
         outDate = dateFormat.parse(strTmp);
         System.out.println("Converted into Date(dd/MM/yyyy HH:mm:ss): " + dateFormat.format(outDate));
         catch(Exception e){ System.out.println("Exception in format 1: " + e);}
         // Format Jan 21, 2007
         dateFormat = new SimpleDateFormat("EEE, MMM d, ''yyyy");
         try
         outDate = dateFormat.parse(strTmp);
         System.out.println("Converted into Date(EEE, MMM d, ''yyyy): " + dateFormat.format(outDate));
         catch(Exception fe)
         {System.out.println("Exception in format 2: " + fe);}
    public static void main(String args[]) {
              stringToDate dF = new stringToDate();
              dF.convertIntoDate();
    }Following is the error message:
    Entered string for date: 21/1/7 18:23:14
    Converted into Date(dd/MM/yyyy HH:mm:ss): 21/01/0007 18:23:14
    Exception in format 2: java.text.ParseException: Unparseable date: "21/1/7 18:23:14"
    Now as per the above error message format one is working fine but format 2(// Format Jan 21, 2007) have some issues...kind suggest.
    Edited by: vinee on Oct 2, 2008 4:23 AMPlease re-read my last reply.
    Once again : see [http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html]
    And your:
    int year=07; // should be:
    int year=2007;

Maybe you are looking for

  • Cannot send email w/mac mail using Juno and Tiger

    Hello! I have had a problem ever since I upgraded last year to Tiger. I have Juno, and ever since I upgraded from Jaguar, I cannot use the Juno software to log on. But more annoying that that (I have a work around that works just fine), I cannot send

  • Procurement Confirmation Wizard Order of Lines

    Hi, I have a problem in SAP B1 8.81 whith Procurement Confirmation Wizard. When  I create a Purchase Order from a Sales Order the order of lines don't be respected. Thanks for your help Marco

  • Outlook 07, Non Mac / own domain emails and the iPhone

    I am thinking about whether to buy an iPhone 3G or the Blackberry Bold. I am confident that I will be able to get my email to work with the Blackberry. Since finding mobileme will not sync no me.com email folders from outlook I am now worried that I

  • Firefox will not load any american express website

    any and all american express webistes load partially but never fully load

  • Loading Properties

    In my aplication i need configurable properties from a properties file and amexploring which is the best way 1. I can store them in a properties file, say, ABC.properties, using a static class or a Singleton to a access the properties. 2. Use a Resou