Date Format (Need result in date format)

Dear ,
i have worked on this query which produce result in error, infact i need result in date format and this format 'MON-YY'. :
select to_date( EFFECTIVE_DATE,'MON-YY' ) as MON_YY FROM GL_JE_LINES
but now EFFECTIVE_DATE is like this format '12/31/2008'

I tell again: a date has no internal format.
There is only a default output-format for date-objects wich is used as default output format and for implicit date conversions.
If you want to know the actual nls_date_format for your session you can use:
select * from nls_session_parameters where parameter='NLS_DATE_FORMAT';You can change it for your session with:
alter session set nls_date_format='<your_new_date_format>';Please take a look at:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams122.htm
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#sthref405
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements003.htm#BABGIGCJ
The internal storage of a date-object does not depend on the actual value of NLS_DATE_FORMAT.
This will only used for output and for implicit conversions e.g. with to_date or to_char without explicit format.
To select a date from a table is also an implicit conversion to character, because you want to see characters on your screen.
Edited by: hm on 29.12.2010 04:20

Similar Messages

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • I have a western digital external hard drive that needs to be re formatted for use on my but iMac but I do not want to lose existing data

    I have a Western Digital external hard drive that needs to be re formatted for use on my iMac, but I do not want to lose existing data, is this possible ?

    Formatting a disk always erases all the data on it. Your only option is to back it up elsewhere and restore it once formatted.

  • Date format needs to be in selection screen mm/dd/yyyy but in alv output ..

    hi
    i need help on displaying date in alv output
    date format needs to be in selection screen mm/dd/yyyy but in alv output ..it should be displayed as yyyymmdd
    regards
    Nishant

    hi,
    you are passing the value to ALv using an internal table.
    so store the format  YYYYMMDD date in the internal table and pass it to ALV.
    use the below FM
    DD/MM/YYYY -> YYYYMMDD
    <b>CONVERSION_EXIT_PDATE_INPUT</b>
    rgds
    Anver

  • Date format and number format- need help

    Hi everyone,
    I'm working with JDeveloper10.1.2, struts and uix pages.
    I have 2 problems:
    1 - I have a field of type date in my uix page and the format is like this='24-Jun-2006', but I need to change this format to be '2006/06/24'.
    2 - I have an attribute of type number(salary) and when I drag and drop this attribute from the DataControl Pallete and run the project, in the uix page I see a number, for example: salary = '123456', but I should see salary = '123.456,00'.
    And when I write, for example '123.456,00', when I commit this value, I should see in my DataBase something like this '123456,00'.
    I alredy tried to change the attribute properties in the Entity Object but without success. :(
    Can anyone help me with this problems?
    Thanks,
    Atena
    Message was edited by:
    Atena

    nd when I write, for example '123.456,00', when I
    commit this value, I should see in my DataBase
    something like this '123456,00'.Sorry I replied before thinking about the problem. You will not see the value in the db as such, the db will show the values differently depending on the session settings.
    The values will only show up as such in the form. To see them such in the db do:
    alter session set nls_date_format='yyyy.mm.dd'
    for the date and
    alter session set nld_number_format='0.00'
    for the number

  • Need difference in date in hh24:mi:ss format

    Have 2 date fields in a table. Need the difference between the dates in hh:mi:ss format
    Here is my table:
    create table test(
    ID number,
    StartDate date,
    FinishDate date,
    DateDifference varchar2(13));
    Here is my record:
    insert into test values (1, to_date('01/21/2010 10:05:10','mm/dd/yyyy hh:mi:ss'), to_date('01/21/2010 11:05:10','mm/dd/yyyy hh:mi:ss'), NULL);
    Want to populate the DateDifference field as difference between FinishDate and StartDate which in this case would be: 01:00:00. Format needs to be hh:mi:ss.

    Hi,
    As long as the differences are less than 24 hours, you can say somehting like:
    UPDATE     test
    SET     DateDifference = TO_CHAR ( TRUNC (SYSDATE) + ( FinishDate
                                                   - StartDate
                         , 'HH24:MI:SS'
    ;For longer amounts of time, you can extract part of an INTERVAL DAY TO SECOND:
    UPDATE     test
    SET     DateDifference = SUBSTR ( NUMTODSINTERVAL ( FinishDate - StartDate
                                              , 'DAY'
                        , 7
                        , 13
    Thanks for posting the sample data in such a nice form!
    Even in a simple job it helps.
    Edited by: Frank Kulash on Jan 22, 2010 2:15 PM
    Had better idea for difference >= 24 hours.

  • 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;

  • Mac OS X Boot failure... I cant Repair HDD with OS Disk,Shows Repair Failed. I cant backup my files from HDD. Backup failed. But I need my all datas from HDD. I dont want to format. Cant enter safemode also. anything else..

    Mac OS X Boot failure... I cant Repair HDD with OS Disk,Shows Repair Failed. I cant backup my files from HDD. Backup failed. But I need my all datas from HDD. I dont want to format. Cant enter safemode also. anything else..
    I installed XP @Bootcamp, I cant access my Mac HDD via XP..
    What I do??? Please help me.. please...

    You can try DiskWarrior (about $100).
    If that doesn't work, and if you have no backups at all, you might need to send your hard drive to Drive Savers or a similar service. It will cost a lot of money to get the data back, I'm sorry to say.

  • 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...

  • Date format - need this format --  04/04/2002 - need help?

    Hi, I am trying to get the date into this format 04/04/2002, so I can insert into the database...
    I have this code.. but it display it like this - Apr 4, 2002
    Date t = new Date();
    String today = DateFormat.getDateInstance().format(t)
    Thx
    Rich

    Or because today is the 4th day of the 4th month maybe :
    java.util.Date t = new java.util.Date();
    java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("MM/dd/yyyy");
    System.out.println(df.format(t));

  • How to get GML data in LAT/LONG format rather than LONG/LAT format

    I want to generate GML from my spatial data but sdo_util.to_Gmlgeometry extracts data in LONG/LAT format where as I need it in LAT/LONG format.
    Is there an easy way to extract data in LAT/LONG format otehr than parsing the gml and then switching the Lat and long.

    Hi,
    I think it would have to do how you store your geometries, you might need a transformation before, notice the srsName from the resulting query:
    SELECT TO_CHAR(SDO_UTIL.TO_GMLGEOMETRY(MDSYS.SDO_GEOMETRY(2001, 8307, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1), MDSYS.SDO_ORDINATE_ARRAY(170.5,-43.5))))
    from dual
    -- Result:
    <gml:Point srsName="SDO:8307" xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs="," ts=" ">170.5,-43.5 </gml:coordinates></gml:Point>
    So without a transformation I would say it would be hard to get:
    http://trac.osgeo.org/gdal/wiki/rfc20_srs_axes
    If I come across a simple solution (without some fancy manipulation of the ordinates on a custom function/package) I will post it.
    Cheers

  • How to handle Multiple date formats for the same date field in SQL*Loader

    Dear All,
    I got a requirement where I need to get data from a text file and insert the same into oracle table.
    I am using SQL*Loader to populate the data from the text file into my table.
    The file has one field where I am expecting date date data in multiple formats, like dd/mon/yyyy, yyyy/dd/mon, yyyy/mon/dd, ,mm/dd/yyyy, mon/dd/yyyy.
    While using SQL*Loader, I can see Loading is failing for records where we have formats like yyyy/dd/mon, yyyy/mon/dd, mon/dd/yyyy.
    Is there any way in SQL*Loader where we can mention all these date formats so that this date data should go smoothly into the underlying date column in the table.
    Appreciate your response on this.
    Thanks,
    Madhu K.

    The point being made was, are you sure that you can uniquely identify a date format from the value you receieve? Are you sure that the data stored is only of a particular limited set of formats?
    e.g. if you had a value of '07/08/03' how do you know what format that is?
    It could be...
    7th August 2003 (thus assuming it's DD/MM/RR format)
    or
    8th July 2003 (thus assuming it's MM/DD/RR format)
    or
    3rd August 2007 (thus assuming it's RR/MM/DD format)
    or
    8th March 2007 (thus assuming it's RR/DD/MM format)
    or even more obscurely...
    3rd July 2008 (MM/RR/DD)
    or
    7th March 2008 (DD/RR/MM)
    Do you have any information to tell you what formats are valid that would allow you to be specific and know what date format is meant?
    This is a classic example of why dates should be stored on the database using DATE datatype and not VARCHAR2. It can lead to corruption of data, especially if the date can be entered in any format a user wishes.

  • When Exporting a Crystal Report to Excel format all of the dates get changed when viewed on Mac version of Excel

    We're using Crystal Reports 10 and when we export a report from the Crystal Viewer using either the MS Excel 97-2000 option or the MS Excel 97-2000 (Data Only) option, the date columns on the report appear as expected on a PC version of Excel, however, most of the users at our company use Macs so when they open the same report on the Mac version of Excel all of the dates show up as 2011 or 2012 dates eventhough they are suppose to be 2008 dates. We've tried to just open the report after the export process and then do a "Save As" but get the same result. The date columns all appear to be formatted as Date. The dates on the Crystal Viewer appear as expected when viewed on a Mac. The users are running Excel for Mac OS-X Service Release 1.0. Any idea why this may be happening and is there a solution to this problem? Thanks!

    Hi,
    To clarify, are you currently using the Mac version of Crystal Reports Viewer 2008 which you downloaded from here?: http://www.sap.com/solutions/sapbusinessobjects/sme/reporting/viewer/index.epx

  • How do I save a PDF as an excel file when the PDF is horizontal. Adobe tries to rotate the page, but the data is entered in an  horizontal format.

    How do I save a PDF as an excel file when the PDF is horizontal. Adobe tries to rotate the page, but the data is entered in an  horizontal format.

    Thanks for the quick reply.  I figured out how to get the desired results by using tagging.  For anyone who may reference this post in the future, I went to "Customize" in the top right corner of Adobe, then selected "Create new tool set...", looked under "accessiblity and found the "tag" option.  Hit ok, tag is added to the toolbar.  Then I highlighted the dataset in the PDF that was relevant to the output format, then clicked "tag", saved as spreadsheet.  Sorry I can't provide more details on how tagging works or if there's a more elegant solution available, but I'm sure one's out there.

  • Date format error while accessing date from SQLSERVER

    Hi all, in me webdynpro application I have taken Date type for the Input Field.
    At date select it is displaying in the format
      *2/14/2009 i.e. mm/dd/yyyy*
    And when I am saving date in the sql database then the date format changes to..
    2009-02-14 i.e..yyyy/mm/dd.
    But using the Date format method I have changed the format as per the need to push date in the SQL database table...
    In the table SQL the date attribute is in form i.e.    02/14/2009 as like from the date select from the date Input Fieldu2026But the problem is that database is not being able to display in that Input field again.
    I have use the coding both at Insertion and selection of the database i.e..
    Date Sdate, Edate;
    Sdate     =   Date.valueOf (rs.getString ("Sdate"));
    Edate     =   Date.valueOf (rs.getString ("Edate"));
    SimpleDateFormat date Formatter = new SimpleDateFormat ("MM/dd/yyyy");
    Sdate = wdContext.currentProjectElement ().getEdate ();
    Edate = wdContext.currentProjectElement ().getEdate ();
      String Sd = dateFormatter.format (Sdate);
      String Ed = dateFormatter.format (Edate);
      Date Sdd =Date.valueOf (Sd);
      Date Edd =Date.valueOf (Ed);
    But at selection of the database the error for the date format isu2026.
    java.lang.IllegalArgumentException
    If somebody knows how to resolve this ,plz let me know
    Regards:
    SK

    for displaying the value only, I think, you are converting to string.
    sol1:
    1. Create a simple type in dictionary: under Dictionary -> Local Dictionary -> Simple Types
    2. go to Definition tab: Change Built-in Type as Date
    3. go to Representation tab: specify format e.g.: MM/dd/yyyy
    4. go to Context and change the date context attribute to the created type.
    sol2:
    please try to minimize the casting between Date and String.
    I believe in database date is stored as Date type itself. My suggestion will be for displaying keep a separate attribute and set it on each db call.
    below code is converting from Date to String.
    Date Sdate, Edate;
    Sdate = rs.getDate ("Sdate");
    Edate = rs.getDate ("Edate");
    SimpleDateFormat date Formatter = new SimpleDateFormat ("MM/dd/yyyy");
    String Sd = dateFormatter.format (Sdate);
    String Ed = dateFormatter.format (Edate);

Maybe you are looking for