Date Format amd Sorting

In my sql query I have a statement like this to_char(TRDATE,'DD-Mon-YYYY'). I am converting this to character to display in DD-Mon-YYYY format. Since it is character and when user tries to sort in the report, it is not sorting based on date.
So if I would like to display in DD-Mon-YYYY format and I want to sort based on dates, how can I achieve this?
Thanks

Why? what is your problem. It is working here --
SQL>
SQL>  select hiredate,to_char(hiredate,'dd-mon-yyyy')
  2   from emp
  3   order by hiredate desc;
HIREDATE  TO_CHAR(HIREDATE,'DD-MON-YYYY'
23-MAY-87 23-may-2087
19-APR-87 19-apr-2087
23-JAN-82 23-jan-1982
03-DEC-81 03-dec-1981
03-DEC-81 03-dec-1981
17-NOV-81 17-nov-1981
28-SEP-81 28-sep-1981
08-SEP-81 08-sep-1981
09-JUN-81 09-jun-1981
01-MAY-81 01-may-1981
02-APR-81 02-apr-1981
HIREDATE  TO_CHAR(HIREDATE,'DD-MON-YYYY'
22-FEB-81 22-feb-1981
20-FEB-81 20-feb-1981
17-DEC-80 17-dec-1980
14 rows selected.Exactly what do you want? Can you specify it more?
Regards.
Satyaki De.

Similar Messages

  • Supported date formats for sorting

    Can someone point me to a document describing the supported
    date formats for sorting? I mean, how should I format a date column
    in an XML dataset in order to have this column correctly sorted
    using the Spry framework?
    Thank you and sorry if the question is trivial.

    Thanks, what I have done for the moment as a temporary
    solution is to use the two date formats and have them both inside
    the one cell in the table (the column for the sortable date
    yyyy-mm-dd). In my CSS I have created a style for the first date
    that has it's visibility as hidden. That way it's sorting the Date1
    but only Date2 is being shown to the users as the other cells have
    more than one line of text it doesn't look too off centre.
    <div spry:region="ds2">
    <table width="662">
    <tr>
    <th width="127" class="eventhead"
    spry:sort="Date1">Date</th>
    <th width="151" class="eventhead"
    spry:sort="Type">Type</th>
    <th width="146" class="eventhead"
    spry:sort="Title">Title</th>
    <th width="189" class="eventhead"
    spry:sort="Venue">Venue</th>
    </tr>
    <tr spry:repeat="ds2" spry:setrow="ds2">
    <td height="53" class="event">{Date2}<span
    class="eventhide">{Date1}</span></td>
    <td class="event">{Type}</td>
    <td class="event">{Title}</td>
    <td class="event">{Venue}</td>
    </tr>
    </table>
    </div>
    </div>
    It seems to be working for the moment...

  • Character field with date format alike & character entered

    Hi all,
    I got one character field created ( varchar2 ) for the purposed to let user the enter the date and also any character since it is a character field.
    Hence, my field may contain the following data :-
    Ship_date
    01/10/2010
    07/02/2011
    15/01/2011
    25/01/2011
    31/01/2011
    TBA
    STOP
    11/01/2011
    TBA
    Hence when come to sorting, I will like it to be date format like sorting so that the earlier date will display first then only follow by the character. The expected result will be :-
    ship_date
    01/10/2011
    11/01/2011
    15/01/2011
    25/01/2011
    31/01/2011
    07/02/2011
    STOP
    TBA
    Trying to do the normal sorting, it does not exactly sort on the date format, as it only sort on the first two character on the date hence I am not getting the correct sorting on this.
    01/10/2011
    07/02/2011
    11/01/2011
    15/01/2011
    25/01/2011
    31/01/2011
    STOP
    TBA
    Could someone help me on this. Thanks.
    Lim

    Hi, Lim,
    sm**** wrote:
    Hi all,
    I got one character field created ( varchar2 ) for the purposed to let user the enter the date and also any character since it is a character field.That's a very bad idea. Use a DATE column for storing dates. Have another, separate column for VARCHAR2 data.
    Hence when come to sorting, I will like it to be date format like sorting so that the earlier date will display first then only follow by the character. The expected result will be :-
    If you must deal with the table as it is:
    ORDER BY  CASE
              WHEN  TRANSLATE ( ship_date
                        , '012345678'
                        , '999999999'
                        ) = '99/99/9999'
              THEN  SUBSTR (ship_date, 7)
                 || SUBSTR (ship_date, 4, 2)
           END
    ,       ship_dateThe CASE expressionj sorts anything the looks like a date ('99/99/9999' where '9' stands for any digit) first, in order by the last 4 digits, then the middle 2 digits. The first 2 digits are sorted by the second ORDER BY expression.
    I will like it to be date format like sorting so that the earlier date will display first then only follow by the character. The expected result will be :-
    ship_date
    01/10/2011
    11/01/2011
    15/01/2011
    25/01/2011
    31/01/2011
    07/02/2011That must be a mistake. I don't believe you want January to come after October and before February, but if you do, you can change what comes after THEN in the CASE expression.

  • Sort Date format in Oracle XML Publisher

    Hi All,
    I have a requirement like trx_date sort. i have taken trx_date in dd-mon-yyyy format. now i given sort option like this..
    <?for-each:G_TRX_ORDER_NUMBER?><?sort:TRANSACTION_TYPE?><?sort:DUE_DATE;'ascending';data-type=date?> <?sort:TRX_NUMBER?>
    now i have 3 dates
    07-NOV-10
    20-MAY-11
    20-DEC-10
    using above sort option.. this dates are not coming as per the ascending order.
    Can any one tell me what i have to ?
    Thanks

    What is your application release?
    Does the sort work for other data types?
    What if you change "<?sort:DUE_DATE;'ascending';data-type=date?>" to "<?sort:DUE_DATE;'ascending';data-type='date'?>", does it make any difference?
    Few examples about the sort can be found in these docs/links.
    How to Group Data Dynamically at Runtime in a BI/XML Publisher RTF Template? [ID 1062816.1]
    Sorting Data In eText Template [ID 1263511.1]
    Oracle XML Publisher User's Guide
    http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115xdoug.zip
    Thanks,
    Hussein

  • Date Format for Spry data set sort

    Hi
    Just feeling my way through the use of Spry Datasets for the
    first time and have a couple of issues hopefully someone with more
    knowledge of it than me know the answer to.
    I had an issue with my Spry Dataset initially that it would
    not work in ie7 but was OK in FF3.
    After some mucking round I realised the error I was getting -
    albeit obscure in IE was telling me it was a date format issue in
    my data set.
    The db data I am playing with here is fairly simple: I have a
    couple of text fields, an integer field that contains the
    unixtimestamp of the entry (its a simple diary application) and a
    formal date field that holds the same date in mysql's date format.
    When I display the date in the dataset I do so in the format
    "23rd May 2009" (as an example)- I code this using phps date
    function in my xml query.
    I had set this field to date format in the Spry dataset
    conditions but IE seems to barf on this- I can change it to
    textstring but then my sort is done on Alpha/Numeric sort of the
    first character in the date field which is rubbish.
    I only display the date in this format and one of the other
    text fields in my dataset- the unixdate is for programmatic
    purposes not general display so I cannot sort on this field if its
    invisible. How can I acheive a date based sort with this set up- or
    what date formats does Spry code prefer for date sorts? (My client
    wants the date to show as I have explained). Many thanks. I have a
    second query which I will post separately!
    Kenny

    "Tanushiheadbash" <[email protected]> wrote
    in message
    news:gqa70o$iat$[email protected]..
    > I think I follow what you are saying and in fact I think
    its what I
    > already
    > have. I have set the sort order to use the unixtime when
    the page
    > initially
    > loads and thats OK.
    I am sorry, but you aren't following my explanation. English
    isn't my mother
    tongue, and I am not able to explain it any better.
    > However what I need to be able to do is to have the
    AJAX/Javascript sort
    > (done in this case with Spry- ) to sort on the date when
    the column header
    > is
    > clicked. The problem I have is the date format in this
    visible column is
    > in
    > DDth Month YYYY format and Spry does not recocnise this
    as a date format-
    > it
    > wants it as a string ( or ie gives an error). Maybe its
    not possible what
    > I am
    > trying to do- just thought there might be a clever way
    to implement this.
    You can take a look at this page:
    http://visual.unipv.it/tmt_calendar/admin/reports/events.cfm
    Even if all the dates here are incidentally using the
    yyyy-mm-dd format, the
    dataset display the date from the "start_date_formatted"
    field:
    <td><a href="javascript:"
    onclick="showUpdate('{event_id}')">{start_date_formatted}</a></td>
    But uses another field to sort the table:
    <th scope="col" spry:sort="start_date">Start
    date</th>
    You can have the same date, using two different formats,
    inside two,
    separated dataset fields. One is used for display, the other
    one is used for
    sort.
    You may try to read again my previous explanations, look at
    the code in the
    page above and see if you get the idea.
    Massimo Foti, web-programmer for hire
    Tools for ColdFusion, JavaScript and Dreamweaver:
    http://www.massimocorner.com

  • DECODE function to validate date value and sort the records

    Hi Friends,
    I am looking for some query which can give me the required output,
    I need to do this using SQL query only and I have tried using the MIN() and MAX() functions it was working fine with limited data, now after inserting the last record(in the below table) which has date for start_range and end_range in(mm/dd/yyyy hh24:mi:ss) format.
    Because the data type is VARCHAR2 if I am using the MIN() function it is sorting as a string value, hence the min date is incorrect. I tried using validating the value to date or non date and tried to using MIN() and MAX() functions using the DECODE function, I am getting this error "ORA-01840: input value not long enough for date format".
    select table_name,
    DECODE(substr(START_RANGE,3,1)||substr(START_RANGE,6,1)||substr(START_RANGE,11,1)||substr(START_RANGE,14,1)||substr(START_RANGE,17,1),'// ::',
    to_char(min(to_date(start_range,'mm/dd/yyyy hh24:mi:ss')),'MM/DD/YYYY HH24:MI:SS'),min(start_range)) MIN_RUNS_START_RANGE,
    DECODE(substr(END_RANGE,3,1)||substr(A.END_RANGE,6,1)||substr(END_RANGE,11,1)||substr(END_RANGE,14,1)||substr(END_RANGE,17,1),'// ::',
    to_char(max(to_date(END_RANGE,'mm/dd/yyyy hh24:mi:ss')),'MM/DD/YYYY HH24:MI:SS'),max(END_RANGE)) MAX_RUNS_END_RANGE
    from MY_TABLE
    GROUP BY table_name,
    (substr(START_RANGE,3,1)||substr(START_RANGE,6,1)||substr(START_RANGE,11,1)||substr(START_RANGE,14,1)||substr(START_RANGE,17,1)),
    (substr(END_RANGE,3,1)||substr(END_RANGE,6,1)||substr(END_RANGE,11,1)||substr(END_RANGE,14,1)||substr(END_RANGE,17,1))
    Can sombody please advise what is the best way I can query this data with the required output.
    The following are the source table and records and the out put records using the sql query.
    MY_TABLE
    TABLE_NAME(VARCHAR2),START_RANGE(VARCHAR2),END_RANGE(VARCHAR2)
    TABLE1,1000,10000
    TABLE2,ABCD,EEEE
    TABLE3,01/12/2010 00:00:00,12/31/2010 23:59:59
    TABLE1,10001,20000
    TABLE2,EEEF,GGGG
    TABLE3,01/01/2011 00:00:00,01/31/2011 23:59:59
    OUTPUT :
    TABLE_NAME,MIN(START_RANGE),MAX(END_RANGE)
    TABLE1,1000,20000
    TABLE2,ABCD,GGGG
    TABLE3,01/12/2010 00:00:00,01/31/2011 23:59:59
    Thanks
    Kalycs

    i also think this is a very bad table design ...
    but if you are not able to change it, you could split the select (date and non-date data) and combine the result with UNION like this:
    with t as
    SELECT 'TABLE1' table_name,'1000' start_range,'10000' end_range FROM dual UNION
    SELECT 'TABLE2','ABCD','EEEE' FROM dual UNION
    SELECT 'TABLE3','01/12/2010 00:00:00','12/31/2010 23:59:59' FROM dual UNION
    SELECT 'TABLE1','10001','20000' FROM dual UNION
    SELECT 'TABLE2','EEEF','GGGG' FROM dual UNION
    SELECT 'TABLE3','01/01/2011 00:00:00','01/31/2011 23:59:59' FROM dual
    SELECT table_name,
           TO_CHAR(MIN(TO_DATE(start_range, 'MM/DD/YYYY HH24:MI:SS')), 'MM/DD/YYYY HH24:MI:SS'),
           TO_CHAR(MAX(TO_DATE(end_range, 'MM/DD/YYYY HH24:MI:SS')), 'MM/DD/YYYY HH24:MI:SS')
    FROM t
    WHERE start_range LIKE '%/%/%:%:%'
    GROUP BY table_name
    UNION
    SELECT table_name,
           MIN(start_range),
           MAX(end_range)
    FROM t
    WHERE start_range NOT LIKE '%/%/%:%:%'
    GROUP BY
        table_name;
    TABLE_ MIN_VALUE           MAX_VALUE
    TABLE1 1000                20000
    TABLE2 ABCD                GGGG
    TABLE3 01/12/2010 00:00:00 01/31/2011 23:59:59

  • Date format issue in Web Analysis...

    Hi,
    I am creating a report by connecting to a couple of relational tables. I'm using SQL Spreadsheet and SQL Subscription objects. I'm creating a Date filter using SQL Subscription object (list box) using the data source created by the SQL Spreadsheet. My database default date format is 'DD-MON-YYYY'. But in the list box it shows as 'YYYY-MM-DD HH24:MI:SI". When this value is selected, I get a "Literal mismatch error" since it doesn't match with the value stored in the database.
    Why the format in WA is showing in this format even though it is fetchting it from my database in which the format is 'DD-MON-YYYY'. Is this related to WA date format settings? I cannot find anywhere in WA studio where I can set date formats. Is this something to be set in the server or webanalysis.properties file?
    PS: I tried to work around this by storing the date value as character in the database but then I am not able to sort them ascending or descending order.I also tried creating the web analysis relational database connection which creates a virtual cube. But even there when I build the report using Data Source Navigator, it is showing date in 'YYYY-MM-DD HH24:MI:SI'.
    H

    Hi,
    Let me provide you the details of the report.
    A concurrent program has been created with executable as XDODTEXE (XML publisher report).
    In the data definition, we have embed one query which fetches transaction date and due date from some tables based on some conditions.
    Now, we have to show these date columns in report output which will be in EXCEL format.
    We want these date outputs to be printed in dd/mm/yyyy format. That is the reason we had given-
    TO_CHAR(TO_DATE (SUBSTR(transaction_date,1,10), 'DD/MON/RRRR'),'DD/MM/RRRR') in the SQL query.
    Problem in output is- In date columns, data after 12th is fine i.e. in format dd/mm/yyyy, it is printing properly.
    But before 12th, it is printing in format mm/dd/yyyy as mentioned below-
    01/10/2012--wrong format, it should be 10/01/2012
    01/11/2012--wrong format, it should be 11/01/2012
    01/12/2012--wrong format, it should be 12/01/2012
    13/01/2012--correct format (dd/mm/yyyy)
    14/01/2012--correct format (dd/mm/yyyy)
    How can i send you the attachment, is there any way/any email id?
    Rgds-
    Sumir

  • XML Publisher to Excel Report : Date format problem

    Hi,
    I am trying to create an Excel report with XML Publisher. I have an issue with the Date Fomatting.
    In the XML template, I have set the "Date" column in date format. But the excel output report "Date" column returns as "General text" (string) and it is sorted as text, not as date.
    Can anyone please help me out?
    Thanks!!!

    Hi,
    Did this post solve your problem? I have the same issue that I need to solve.
    I have an xsl-fo template with dates in it.
    The dates are in english.
    My excel is setup to use danish.
    When I export to excel it knows the month jan, feb, mar, apr, ... which are the same in danish and english.
    But months where it differs like may (danish maj) the cell is a general text instead of date.
    Is there anyway you can set/transform the date in the xsl-fo template so it does not care about the language in excel?
    Thank you in advance.
    BR Kenneth

  • How Do i create a list that will show in a dropdown box with the list being pulled from another tab and not the cell data format junk?

    How Do i create a list that will show in a dropdown box with the list being pulled from another tab and not the cell data format junk?
    I currently run OS X 10.10.1
    Now i have been trying to work on this for a while now and what i want to do should be simple but its apparently not.
    Here is an example of what i want to happen.
    I will have 2 tabs: Contact | Sales
    Now Contacts will have the list of names and various information about a customer, While Sales will have one drop-down box for each Cell Row that will show the names of the person in tab contacts
    for what i am wanting to do i cant use the data format pop-up menu because the list is edited everyday several times a day.
    Now how do i do this, Excel can do this so how can numbers do it?

    Hi Shegra,
    Paste this into a applescript editor window and run it from there. In the script you may need to adjust the four properties to agree with your spreadsheet. Let me know if you have any questions.
    quinn
    Script starts:
    -- This script converts column A in one table into an alphabetized list of popups. It copies the last cell in that column. Then reverts the column to text. It then refreshes popups in column A of a data table starting with a user defined row.
    property DataEntrySheet : "Sheet 1" --name of sheet with popups to be refreshed
    property DataEntryTable : "Sales" --name of table with popups to be refreshed
    set copyRange to {}
    property PopValueSheet : "Sheet 1" --name of sheet with popup values table
    property PopValueTable : "Contacts" --name of table with popup values
    set PopStartRow to {}
    tell application "Numbers"
      set d to front document
      set ps to d's sheet PopValueSheet
      set pt to ps's table PopValueTable
      set s to d's sheet DataEntrySheet
      set t to s's table DataEntryTable
      set tf to t's filtered --this records filter setting on data Entry Table
      display dialog "Start from row #..." default answer "" with icon 1 -- with icon file "Path:to:my.icon.icns" --a Week # row
      set PopStartRow to {text returned of result}
      tell pt --convert list to alphabetized popups
      set ptRows to count rows
      set copyRange to ("A2:" & name of cell ptRows of column "A")
      set selection range to range copyRange
      set selection range's format to text
      sort by column 1 direction ascending
      set selection range's format to pop up menu
      -- popupsmade
      set selection range to cell ptRows of column 1 of pt
      set v to value of cell ptRows of pt
      end tell
      activate application "Numbers"
      tell application "System Events" to keystroke "c" using command down
      tell pt
      set selection range to range copyRange
      set selection range's format to text
      end tell
      tell t
      set filtered to false
      set tRows to count rows
      set pasteRange to ((name of cell PopStartRow of column "A") & ":" & (name of cell tRows of column "A"))
      set selection range to range pasteRange
      tell application "System Events" to keystroke "v" using command down
      set filtered to tf
      end tell
    end tell

  • How to convert the date format 'm/d/yyyy hh:mi:ss AM' to 'MM/DD/YYYY HH:M'

    How can i convert a the date format 'm/d/yyyy hh:mi:ss AM' to 'MM/DD/YYYY HH:MI:SS AM' in Oracle
    I have a query
    select UPPER(t.val_10) "TYPE", count(val_3) "Number of Transfers"
    from table1 t
    where t.is_active = 1
    and t.val_4 = 'INBOUND'
    and to_date(to_date(val_5,'MM/DD/YYYY HH:MI:SS AM'), 'DD/MM/YY') between to_date(to_date('01/08/2008 00:00:00','DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YY') and add_months(to_date(to_date('01/08/2008 00:00:00','DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YY'),1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)
    I get the error [ORA-01861: literal does not match format string which i think is because
    val_5 has the values in the following format:
    8/29/2008 6:31:10 PM
    Does anyone have an answer?
    Thanks in advance
    Edited by: user2360027 on 26-Mar-2009 03:50                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    first off, you've got to_date(to_date(...)) - NEVER do this - you're forcing an implicit to_char which can cause all sorts of problems!
    What is the data type of your column val_5? If it's DATE then your query is simply:
    select UPPER(t.val_10) "TYPE",
           count(val_3) "Number of Transfers"
    from   table1 t
    where  t.is_active = 1
    and    t.val_4 = 'INBOUND'
    and    val_5 between to_date('01/08/2008','DD/MM/YYYY') and add_months(to_date('01/08/2008','DD/MM/YYYY') ,1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)If it's a varchar2 (why, oh why, oh why, ...?!), then your query should be:
    select UPPER(t.val_10) "TYPE",
           count(val_3) "Number of Transfers"
    from   table1 t
    where  t.is_active = 1
    and    t.val_4 = 'INBOUND'
    and    to_date(val_5, 'mm/dd/yyyy hh:mi:ss AM') between to_date('01/08/2008','DD/MM/YYYY') and add_months(to_date('01/08/2008','DD/MM/YYYY') ,1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)Remember that dates in DATE format are stored in an internal Oracle format - in order for you to tell Oracle that your string is a date, you need to use to_date. When you want to retrieve a date, you need to use to_char to put it into the format you want to see it in.
    Remember also that your nls_date_format defines the default format that you'll see a date, which is what is used in the implicit conversion that oracle does when you select a date:
    SQL> alter session set nls_date_format='dd/mm/yyyy hh24:mi:ss';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    26/03/2009 11:01:53
    1 row selected.
    SQL> alter session set nls_date_format='mm/dd/yy hh12:mi:ss AM';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    03/26/09 11:02:24 AM
    1 row selected.It doesn't make sense to convert something that's already in a DATE format into a DATE format - in order to do that, oracle has to first change the date into a string, and it does that by using the nls_date_format parameter setting - if you're working with dates-in-strings that are in a different format, then all sorts of problems arise, as you have found out!

  • Date format in MVIEW

    Hi All,
    I have creted the snapshot as
    CREATE SNAPSHOT EMPLOYEE_CRIS_MVIEW
    PCTFREE 10
    PCTUSED 40
    MAXTRANS 255
    TABLESPACE users
    STORAGE (
    INITIAL 40960
    NEXT 73728
    PCTINCREASE 1
    MINEXTENTS 1
    MAXEXTENTS 505
    BUILD IMMEDIATE
    REFRESH ON DEMAND
    With rowid
    AS
    select
    emp_id,
    join_dt,
    emp_stat,
    from employee_CRIS
    The date format for the column join_dt is dd-mon-yyyy.
    But I want to modify the date format for this column as 'MM/DD/YYYY'.
    For that I tried
    ALTER snapshot EMPLOYEE_CRIS_MVIEW modify(TO_CHAR(join_dt,'MM/DD/YYYY'));
    But I got the error
    ERROR at line 1:
    ORA-00902: invalid datatype
    Could you please help me to change the change the date format of the column of the snapshot
    with out dropping the snapshot.
    Please help me.
    Thanks in advance.

    What people are saying is that date columns (of DATE datatype) are stored internally using a fixed internal notation, which is essentially a series of bytes that describe the date.
    e.g.
    SQL> select empno, ename, hiredate, dump(hiredate) as dump_hiredate from emp;
         EMPNO ENAME      HIREDATE            DUMP_HIREDATE
          7369 SMITH      17/12/1980 00:00:00 Typ=12 Len=7: 119,180,12,17,1,1,1
          7499 ALLEN      20/02/1981 00:00:00 Typ=12 Len=7: 119,181,2,20,1,1,1
          7521 WARD       22/02/1981 00:00:00 Typ=12 Len=7: 119,181,2,22,1,1,1
          7566 JONES      02/04/1981 00:00:00 Typ=12 Len=7: 119,181,4,2,1,1,1
          7654 MARTIN     28/09/1981 00:00:00 Typ=12 Len=7: 119,181,9,28,1,1,1
          7698 BLAKE      01/05/1981 00:00:00 Typ=12 Len=7: 119,181,5,1,1,1,1
          7782 CLARK      09/06/1981 00:00:00 Typ=12 Len=7: 119,181,6,9,1,1,1
          7788 SCOTT      19/04/1987 00:00:00 Typ=12 Len=7: 119,187,4,19,1,1,1
          7839 KING       17/11/1981 00:00:00 Typ=12 Len=7: 119,181,11,17,1,1,1
          7844 TURNER     08/09/1981 00:00:00 Typ=12 Len=7: 119,181,9,8,1,1,1
          7876 ADAMS      23/05/1987 00:00:00 Typ=12 Len=7: 119,187,5,23,1,1,1
          7900 JAMES      03/12/1981 00:00:00 Typ=12 Len=7: 119,181,12,3,1,1,1
          7902 FORD       03/12/1981 00:00:00 Typ=12 Len=7: 119,181,12,3,1,1,1
          7934 MILLER     23/01/1982 00:00:00 Typ=12 Len=7: 119,182,1,23,1,1,1
    14 rows selected.Here, you can see from the dumped dates that they are all stored as 7 bytes of data, which sort of resemble the date you see on the screen in some way, but not quite. It's an internal format that Oracle understands and uses, and it's important it's stored in this way so that date arithmetic and date range comparisons can be performed easily (and quickly) in queries.
    If we were to alter our sessions date format (the display format for our session only) and query the data again in the same way...
    SQL> alter session set nls_date_format='YYYY-MM-DD';
    Session altered.
    SQL> select empno, ename, hiredate, dump(hiredate) as dump_hiredate from emp;
         EMPNO ENAME      HIREDATE   DUMP_HIREDATE
          7369 SMITH      1980-12-17 Typ=12 Len=7: 119,180,12,17,1,1,1
          7499 ALLEN      1981-02-20 Typ=12 Len=7: 119,181,2,20,1,1,1
          7521 WARD       1981-02-22 Typ=12 Len=7: 119,181,2,22,1,1,1
          7566 JONES      1981-04-02 Typ=12 Len=7: 119,181,4,2,1,1,1
          7654 MARTIN     1981-09-28 Typ=12 Len=7: 119,181,9,28,1,1,1
          7698 BLAKE      1981-05-01 Typ=12 Len=7: 119,181,5,1,1,1,1
          7782 CLARK      1981-06-09 Typ=12 Len=7: 119,181,6,9,1,1,1
          7788 SCOTT      1987-04-19 Typ=12 Len=7: 119,187,4,19,1,1,1
          7839 KING       1981-11-17 Typ=12 Len=7: 119,181,11,17,1,1,1
          7844 TURNER     1981-09-08 Typ=12 Len=7: 119,181,9,8,1,1,1
          7876 ADAMS      1987-05-23 Typ=12 Len=7: 119,187,5,23,1,1,1
          7900 JAMES      1981-12-03 Typ=12 Len=7: 119,181,12,3,1,1,1
          7902 FORD       1981-12-03 Typ=12 Len=7: 119,181,12,3,1,1,1
          7934 MILLER     1982-01-23 Typ=12 Len=7: 119,182,1,23,1,1,1
    14 rows selected.... whilst the hiredate is now showing on the screen in the format we've chosen, the actual internal storage of those dates remains completely unchanged. i.e. we don't have to change the format of the internal storage of dates to make them display differently.
    Likewise you can format dates manually as part of your query using to_char function...
    SQL> select empno, ename, to_char(hiredate,'DD Month YYYY') as hiredate, dump(hiredate) as dump_hiredate from emp;
         EMPNO ENAME      HIREDATE          DUMP_HIREDATE
          7369 SMITH      17 December  1980 Typ=12 Len=7: 119,180,12,17,1,1,1
          7499 ALLEN      20 February  1981 Typ=12 Len=7: 119,181,2,20,1,1,1
          7521 WARD       22 February  1981 Typ=12 Len=7: 119,181,2,22,1,1,1
          7566 JONES      02 April     1981 Typ=12 Len=7: 119,181,4,2,1,1,1
          7654 MARTIN     28 September 1981 Typ=12 Len=7: 119,181,9,28,1,1,1
          7698 BLAKE      01 May       1981 Typ=12 Len=7: 119,181,5,1,1,1,1
          7782 CLARK      09 June      1981 Typ=12 Len=7: 119,181,6,9,1,1,1
          7788 SCOTT      19 April     1987 Typ=12 Len=7: 119,187,4,19,1,1,1
          7839 KING       17 November  1981 Typ=12 Len=7: 119,181,11,17,1,1,1
          7844 TURNER     08 September 1981 Typ=12 Len=7: 119,181,9,8,1,1,1
          7876 ADAMS      23 May       1987 Typ=12 Len=7: 119,187,5,23,1,1,1
          7900 JAMES      03 December  1981 Typ=12 Len=7: 119,181,12,3,1,1,1
          7902 FORD       03 December  1981 Typ=12 Len=7: 119,181,12,3,1,1,1
          7934 MILLER     23 January   1982 Typ=12 Len=7: 119,182,1,23,1,1,1
    14 rows selected.
    SQL>Again, the internal date format remains the same.
    It is important that, when you store date information you store it as DATE datatype and let oracle use it's internal format, so that it can accurately do the date arithmetic, date range searches and date ordering etc., that everyone likes to do in queries. If you try and store it as VARCHAR2 then not only can information be lost (i.e. is '01/02/2010' representing 1st February 2010 or is it 2nd January 2010?) but you prevent date arithmetic, range searches and ordering in your queries from working correctly (i.e. '03/01/2009' would work out to be a greater date than '01/02/2010'). To prove it...
    SQL> select 'Wrong' from dual where '03/01/2009' > '01/02/2010';
    'WRON
    Wrong
    SQL> ed
    Wrote file afiedt.buf
      1* select 'Wrong' from dual where to_date('03/01/2009','DD/MM/YYYY') > to_date('01/02/2010','DD/MM/YYYY')
    SQL> /
    no rows selected

  • Email Submit and Data format

    I have been reviewing the following document and have 1 question.
    http://www.adobe.com/devnet/livecycle/articles/lc_understanding_submit_tip.pdf
    Is there a way to customize the data format using a submit button?
    I may have the requirement to have end users submit data through an email submit button, but the client wants the data in the format Fieldname [delimiter of some sort] Fieldvalue, is this possible?  Would you need to manually edit the xml in the form to do this? Any pointers would be appreciated.
    The only options I see in the attributes of the email submit button are:
    XDP
    XML
    PDF
    URL encoded data
    Thank you,

    Hi Paul:
    Currently we are using Acroforms and would use these forms originally.
    In the future, this would be used with LiveCycle so it would probably be an XFA/LiveCycle Designer form. I believe in this case, the best solution would be to do this through a submit using Form Server components of LCES.
    Thank you,
    Working for a Living...

  • Date format in flat file of bdc

    Hi Folks,
    In BDC I have a flat file which has to be uploaded from a flat file and 4 users are using each of one has their date format.
    so inorder to get their required date format what i need to do .

    Hi,
           use the below logic in your code.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-031.
    PARAMETERS: date1 RADIOBUTTON GROUP rad1 DEFAULT 'X',                                     "SAP date format YYYYDDMM
                date2 RADIOBUTTON GROUP rad1,                                                 "Date format like aprial31, 2006
                date3 RADIOBUTTON GROUP rad1,                                                 "Date format like 31 apr,2006
                date4 RADIOBUTTON GROUP rad1,                                                 "Date format like DD/MM/YYYY
                date5 RADIOBUTTON GROUP rad1.                                                 "Date format like DD.MM.YYYY
    SELECTION-SCREEN END OF BLOCK b2
    FORM getmonth .
      SELECT mnr
             ktx
             ltx
       INTO TABLE T_month
       FROM t247
       WHERE spras = 'EN'.
      IF sy-subrc NE '0'.
          MESSAGE I                                                          "Message - Not able to get month values from the table T247
      ENDIF.
    ENDFORM.                                                                               
    DATA : temp_date(16)  TYPE c,
             temp1_date(60) TYPE c,
             year(4)        TYPE c,
             daymonth(11)   TYPE c,
             daymonth1(11)  TYPE c,
             month(9)       TYPE c,
             day(2)         TYPE c,
             mon            LIKE t247-ktx,
             len            TYPE i   .
      MOVE date TO temp1_date .
      CONDENSE temp1_date NO-GAPS.
      MOVE temp1_date TO temp_date .
      IF date2 EQ 'X'.                                                                     "The date format is like Aprial 31, 2007
        CONDENSE temp_date NO-GAPS.
        SPLIT date AT ',' INTO daymonth year.
        IF STRLEN( year ) NE '4'.
          error = 'X'.
          WRITE :  'Invalid date format.'.
        ELSE.
          daymonth1 = daymonth.
          CONDENSE daymonth1 NO-GAPS.
          _len      = STRLEN( _daymonth1 ).
          l_len      = 13 - len.
          SHIFT daymonth1 RIGHT BY len PLACES.
          CONDENSE daymonth1 NO-GAPS.
          month    = daymonth1.
          CONDENSE month NO-GAPS.
          SORT t_month BY monthltx.
          READ TABLE t_month WITH KEY monthltx =  month.
          IF sy-subrc <> 0.
            error = 'X'.
            WRITE : 'Invalid date format.' .
          ELSE.
            len = STRLEN( month ).
            CONDENSE daymonth NO-GAPS.
            SHIFT daymonth LEFT BY len PLACES.
            day =  daymonth.
            CONDENSE day NO-GAPS.
            CONCATENATE year t_month-monthnumber day INTO o_date.
          ENDIF.
        ENDIF.
      ELSEIF p_date3 EQ 'X'.                                                                "The date format is like 31 apr, 2007
        CONDENSE temp_date NO-GAPS.
        SPLIT i_date AT ',' INTO daymonth year.
        IF STRLEN( year ) NE '4'.
          error = 'X'.
          WRITE :  'Invalid date format.'.
        ELSE.
          daymonth1 = daymonth.
          CONDENSE daymonth1 NO-GAPS.
          SHIFT daymonth1 LEFT BY 2 PLACES.
          CONDENSE daymonth1 NO-GAPS.
          month  = daymonth1.
          CONDENSE month NO-GAPS.
          TRANSLATE month TO UPPER CASE.
          SORT t_month BY monthstx.
          MOVE month to mon.
          READ TABLE t_month WITH KEY monthstx = mon.                                 
          IF sy-subrc <> 0.
            error = 'X'.
            WRITE : 'Invalid date format.' .
          ELSE.
            CONDENSE daymonth NO-GAPS.
            day =  daymonth+0(2).
            CONDENSE day NO-GAPS.
            CONCATENATE year t_month-monthnumber day INTO o_date.
         ENDIF.
       ENDIF.
      ELSEIF p_date4 EQ 'X' OR p_date5 EQ 'X'.                                             "Date format is like DD.MM.YYYY or DD/MM/YYYY
        CONDENSE temp_date NO-GAPS.
        IF STRLEN( temp_date ) EQ 10.
          o_date0(4) = temp_date6(4).
          o_date4(2) = temp_date3(2).
          o_date6(2) = temp_date0(2).
        ELSE.
          error = 'X'.
          WRITE : 'Invalid date format.' .
        ENDIF.
    ENDIF.
    IF STRLEN( o_date ) NE '8'.
         error = 'X'.
         WRITE : 'Invalid date format.'.
    ENDIf.
    ENDFORM.                                                                               
    regards

  • Date format in mail - "yesterday, the day before,..."

    Hello.
    When using mail in the new version, the left gutter gathering all the inboxes, each message summary displays the essentials infos.
    In many cases the date display is set to show the reception hour on the same day (fine), the previous day is shown as "yesterday" and the day before yesterday as "the day-before-yesterday", and finally "two days ago".
    My system is in french thus it's not written" two days ago" but (I translate) "before-before-yesterday".... This doesn't help me anymore.
    Here is my question: is there a way to set the date format in the message short in order to have the full numerical date as soon as "yesterday", actually to always have a numerical date display ... no more "avant-avant-hier".
    Thanks

    Thanks but...
    I just sort of just figured out the obvious and noticed, that I'd even have a big problem if that regex of mine worked.... unluckily, there actually seem to be days with a number smaller than 3, but no negative days in the human calendar... so I'm going to rest first and think it over after that. Most likely I'm going to end up subtracting a day in unix-time and converting back, better ideas are not necessary but welcome .
    (edit: oh, and thanks again - that might come handy when I ended up with the same $(\[chaos\]) trying the unix time version later)
    Last edited by whoops (2009-08-25 18:29:30)

  • Date Format is different in WebI Rich Client and Infoview

    Hi All,
    Iam facing problem with date format , but i need the date format as like dd-mm-yyyy.
    WEBI Rich Client is displaying the format  dd-mm-yyyy.
    but in infoview it is displaying like mm/dd/yyyy
    Can i have any solution for this ..
    Thanks
    Mahesh

    Hi
    Did you sort this out?
    I am new to BO reporting, and now encountering this issue as I start publishing WEBI reports via INFOVIEW on the portal.
    Cheers,
    Andrew

Maybe you are looking for

  • NFS-e Salvador - BA

    Olá, Alguém já desenvolveu a comunicação para a Nota Fiscal Eletronica de Serviso para Salvador, trabalhamos com outros municipios onde geramos um txt e informamos no site, porém até onde vi no caso de Salvador precisamos de uma comunicação via Web S

  • Mail downloads one email at a time.  ???

    Just noticed this problem today. My main gmail account (I have 4 gmail and 1 yahoo account) will only download one email at a time. One click of "Get Mail", one email. My other accounts all work properly, leading me to think that it's not a gmail pro

  • Photoshop image display problems

    I've recently installed Photoshop CS5 extended on my new comp  It was working fine, but when following a tutorial to make rust or metal it starts having issues. As you can see below the noise in the left hand picture worksfine, but in the right when

  • ITV Catchup TV picture too big

    We have two laptops – the first one is an HP and works OK in Firefox for all TV Channels The second one – an Advent Verona produces the following problem ITV and Catchup TV viewed in Firefox - the picture is about 4 times too big BBCi, 4OD and Demand

  • Create SRM Bid Invitation from R/3 Schdule Agreements

    Hi Masters, How do I create Bid Invitation in SRM from Schedule agreements in R/3. How much of customization is involved for the same. Thanks in advance.