Regarding TO_DATE function and Default Date Format DD-MON-YY

I am using oracle 10.2 version. As far as my knowledge default date format is 'DD-MON-YY'. I want to know that why first query is not giving result.
SQL> select sysdate from dual
2 where sysdate = to_date('06-JUL-11','DD-MON-YY');
no rows selected
SQL> select sysdate from dual
2 where to_date(to_char(sysdate),'DD-MON-YY') = to_date('06-JUL-11','DD-MON-YY');
SYSDATE
06-JUL-11
Thanks,
Rohit

A date in Oracle always contains hours, minutes and seconds. These values can optionally all evaluate to zeroes, at midnight.
TO_DATE('06-JUL-11','DD-MON-YY') means midnight of the sixth of july 2011.
So
sysdate = to_date('06-JUL-11','DD-MON-YY') only at midnight of the sixth of july 2011...
While during the day, after midnight,
trunc(sysdate) = to_date('06-JUL-11','DD-MON-YY')and
sysdate > to_date('06-JUL-11','DD-MON-YY')Max

Similar Messages

  • Set Default Date Format in 4.2 jQuery Mobile Smartphone

    Hi guys,
    on "normal" Desktop interfaces you can set a default date format in the Globalization settings. Currently I'm working on a JQM app, and I noticed, that the same settings I have for date format in other apps, don't take affect.
    I now read in the 4.2 release notes, that somehow this issue was a bit buggy. Is this fixed? I would like to set a german date format like "DD.MM.YYYY"; (as it's working in desktop apps). How can I do it? In global settings this entry gets saved.
    But whenever I want to set an individual date-picker-item to that format, it changes back to "YYYY-MM-DD" after saving. And I don't really want to get into writing a conversion function in the dml-processing now.
    Thanks for any hints, best regards,
    tobi

    Hi Tobi,
    the "Date Picker (HTML5)" item type maps to the HTML5 input type="date", which requires that the internal format of the date value always has to be YYYY-MM-DD, but it's up to the browser to actually display the date in the format of the local operating system setting. The browser of iOS for example shows the date in the format of my local language/country setting.
    See also http://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format
    To make a long story short, it's not possible to specify the display format for those date pickers, because it's not supported by the HTML5 spec.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to change default Date format in BO 6.5 SP4

    A problem with date display has been reported to me by one of our users -  in BO 6.5 - since installing SP4.
    The default date format is now MM/DD/YYYY
    I have tried to recreate this on my PC and have been able to confirm that this is the case.
    Most of our PC's will have two versions of Business Objects on them - for 5.1.6 and for 6.5 - that is the case for my PC.
    If I create a new BO document based on a spreadsheet with three entries in the spreadsheet as follows:-
    20/01/2009    20-Jan-2009  20th January 2009
    This displays in BO 6.5 as
    1/20/2009   1/20/2009    20th January 2009
    My PC regional setting is UK and the time displays DD/MM/YYYY
    Can you advise how to correct this problem please.

    Hi Sebastien
    Thank you for your response.
    I haven't checked Dimension in universe because this is happening even when datasource is an Excel spreadheet - as per details in previous post.
    I have looked for *.sbo files and found one for ODBC.sbo in the Version 5 folders on PC - with date format details in it which I've changed - that doesn't make any difference.
    Any other ideas?
    Regards
    Linda

  • How to update the default date format in OBIEE 11G.

    Hi All,
    How to change the default date format in OBIEE 11g from the MM/DD to DD/MM. Could anyone please help me out ASAP?
    Thanks,
    Arpan

    Hi Arpan
    OBIEE 11g is having " localedefinitions.xml " file at this Location C:\Oracle\Middleware\Oracle_BI1\bifoundation\web\display
    in my case i installed at C:\Oracle\MIddleware.
    so
    1- Stop BI Server from EM
    2- Navigate to this Location C:\Oracle\Middleware\Oracle_BI1\bifoundation\web\display. in your case oracle home will be different
    3- take a backup of this file localedefinitions.xml "
    4- modify it and save
    5- bring BI Server up.
    Regards
    sher

  • Is it possible to change the Database default date format  'dd/mm/yy'

    I'm inserting a date with the format 'dd-mon-yy' in a column, it gives the error:- " a non-numeric character was found where a numeric was expected ". I also tried the TO_DATE function but not successful.
    I want to change the Database default Date format 'dd/mm/yy' to 'dd-mon-yy'. Is it possible?
    version is (Oracle Server 7.3.2.0). I checked it on version ( Oracle Server 7.3.4.0) with format of 'dd-mon-yy'.
    May I keep the both formats at a time?
    Thanks for solution(s),
    Tariq.

    you can try with:
    ALTER SESSION
    SET NLS_DATE_FORMAT = 'dd-mon-yy';

  • Date Format in Zreport similar to the default date format set using su01.

    Dear All,
                I have a requirement as to change the date format in Zreport as the one which is set in default date format for the user in Su01 tcode.
    Ex.. If the user has set the default date format in SU01 as ' YYYY-MM-DD' , in report also, date should appear as '2009-12-24'.
    Is there any code  or  Function Module to change the date format in report as in the default Date format?
    Can u help me in this?
    Bye.....
    Cheers
    Christina.

    Try the following code.
    select the format of current user from usr01 table.
        SELECT SINGLE datfm FROM usr01
        INTO w_datfm
        WHERE bname = sy-uname.
    Format based upon the current user settings. put this total code inside one form for reusability.
        IF w_datfm = '1'.
          CONCATENATE w_date6(2) c_dot w_date4(2) c_dot w_date+0(4) INTO outtab-value.
          CONDENSE outtab-value NO-GAPS.
          CONCATENATE w_rundate6(4) w_rundate3(2) w_rundate+0(2) INTO w_date.
          CONDENSE w_date NO-GAPS.
        ELSEIF w_datfm = '2'.
          CONCATENATE w_date4(2) '/' w_date6(2) '/' w_date+0(4) INTO outtab-value.
          CONDENSE outtab-value NO-GAPS.
          CONCATENATE w_rundate6(4) w_rundate0(2) w_rundate+3(2) INTO w_date.
          CONDENSE w_date.
        ELSEIF w_datfm = '3'.
          CONCATENATE w_date4(2) '-' w_date6(2) '-' w_date+0(4) INTO outtab-value.
          CONDENSE outtab-value NO-GAPS.
          CONCATENATE w_rundate6(4) w_rundate0(2) w_rundate+3(2) INTO w_date.
          CONDENSE w_date.
        ELSEIF w_datfm = '4'.
          CONCATENATE w_date0(4) '-' w_date4(2) '-' w_date+6(2) INTO outtab-value.
          CONDENSE outtab-value NO-GAPS.
          CONCATENATE w_rundate0(4) w_rundate5(2) w_rundate+8(2) INTO w_date.
          CONDENSE w_date NO-GAPS.
        ELSEIF w_datfm = '5'.
          CONCATENATE w_date0(4) '/' w_date4(2) '/' w_date+6(2) INTO outtab-value.
          CONDENSE outtab-value NO-GAPS.
          CONCATENATE w_rundate0(4) w_rundate5(2) w_rundate+8(2) INTO w_date.
          CONDENSE w_date NO-GAPS.
        ENDIF.

  • Default Date Format in ADF 11g RC

    Dear All,
    I am searching for a possibility to set a default date format pattern ("yyyy-MMM-dd") in an ADF 11g RC application.
    I know that I can set this format in every entity/view object's attributes. But I am looking for a central way.
    I already tried to override the javax.faces.convert.DateTimeConverter and configured it in the faces-config.xml.
    But without success.
    Any ideas?
    Thanks!
    Richard

    Hi,
    in another post of yours I pointed you to the trinidad-config.xml file - so you may want to have a look there. Also maybe property sets can give you a helping hand
    http://one-size-doesnt-fit-all.blogspot.com/2008/09/jdev-11g-adf-bc-new-feature-property.html
    Frank

  • How to set a Default date format.

    I would like to know if it's possible to set a default date format (b.e. dd/mm/yyyy) for new date object and not for the current object?
    Thanks

    default date format (b.e. dd/mm/yyyy) for new date objectI would guess not, and that is regardless of how they format it.
    Consider the java.util.Date.toString() method. There is no way to change the behaviour of that unless you want to derive a class from Date.
    At least not in 1.3.0 it isn't. The java.util.Date class uses a private data member called simpleFormatter which it hard codes to
    formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US)
    If however the time was formatted using the defaults from java.text.DateFormat then you could set the TimeZone. However, that doesn't impact formatting, it merely changes the offset (and daylight savings.)
    You could set the Locale in java.util.Locale. That looks like a real possibility. But the documentation doesn't really provide anything that suggests how you provide your own and impact the time stuff. For example, Date which uses static finals for the time stuff - which suggests Locale can't impact it. And of course changing the Locale would impact your entire application, so you would have to make sure all threads were blocked while it was changed.

  • Default Date format

    The book "OCA Oracle Database 11g SQL Fundamentals I Exam Guide (Exam 1Z0-051)" says
    select employee_id, start_date from job_history;in HR schema will yield
    101     21/SEP/89 00:00:00
    101     28/OCT/93 00:00:00
    102     13/JAN/93 00:00:00
    114     24/MAR/98 00:00:00
    122     01/JAN/99 00:00:00
    176     24/MAR/98 00:00:00
    176     01/JAN/99 00:00:00
    200     17/SEP/87 00:00:00
    200     01/JUL/94 00:00:00
    201     17/FEB/96 00:00:00but I get
    101     21-SEP-89
    101     28-OCT-93
    102     13-JAN-93
    114     24-MAR-98
    122     01-JAN-99
    176     24-MAR-98
    176     01-JAN-99
    200     17-SEP-87
    200     01-JUL-94
    201     17-FEB-96Does it depend on any other factors or parameters or flags? Please clarify. I am using Oracle 11g and the exam guide is also for 11g.

    Hi It depends upon the NLS_DATE_FORMAT parameter value
    it may be different
    for me its
    SQL> SELECT value FROM v$nls_parameters WHERE parameter ='NLS_DATE_FORMAT';
    VALUE
    DD-MON-RRDD-MON-YYYY is the default date format given by oralce if you want to change it use
    SQL> alter session set NLS_DATE_FORMAT='YOUR FORMAT'Edited by: Qwerty on Aug 17, 2009 12:41 PM

  • Default date format in IDM?

    Hi,
    Is it possible to set a default date format in IDM so that my role dates etc. are shown as dd-mm-yyyy rather than in the american way.
    Greetings,
    Marijke

    Yes u can .. check the below method
    <invoke name='convertDateToString' class='com.waveset.ui.FormUtil'>
    <!-- date: java.util.Date -->
    <!-- simpleDateFormatPattern: java.lang.String -->
    </invoke>

  • To change the default date format of OID

    Hello Gurus,
    Any idea on how to change the default date format of OID?
    The default date format of OID is something like "yyyy-mm-dd hh:mm:ss .0-0700" I want to change it to "yyyymmddhhmmss.0-0800".
    Is there any system property to do the same.
    I have provisioned users from OIM to OID.
    Any ideas/clues/hints on this.
    TIA,
    - oidm.

    nobody? ?

  • Need regular expression for oracle date format 'DD-MON-YYYY'

    Hi,
    Can anybody tell me the regular expression to validate date in 'DD-MON-YYYY'.
    My concept is i have a table with just two columns item_name and item_date
    Both fields are varchar2 and i want to fetch those records from this table which have valid date format('DD-MON-YYYY').

    If it must be a regexp, this is a starter for you, note it carries the caveats mentioned by both posters above and in the linked thread
    mkr02@ORA11GMK> with data as (select '10-jan-2012' dt from dual
      2  union all select '10-111-2012' from dual
      3  union all select 'mm-jan-2012' from dual
      4  union all select '10-jan-12' from dual)
      5  select
      6  dt,
      7  case when regexp_like(dt,'[[:digit:]]{2}-[[:alpha:]]{3}-[[:digit:]]{4}','i') then 1 else 0 end chk
      8  from data
      9  /
    DT                 CHK
    10-jan-2012          1
    10-111-2012          0
    mm-jan-2012          0
    10-jan-12            0It will not validate content, only string format.
    And to emphasis the points made in the linked thread - dates in text columns is poor design. Always.

  • Default date format in oracle

    Hi
    What is the default format of date in oracle?
    When I rum the following query
    select * from emp where hiredate='03-december-1981' ...
    It is returning two records.
    How is it possible?

    Kamran Agayev wrote:
    For input and output of dates, the standard Oracle date format is DD-MON-YY
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i1847
    Although it's there in the documentation, I find it misleading, as many times, the default nls_date_format has been changed to something else, either by the dba's, or by a front end application or whatever.
    It is ALWAYS safest to use to_date and to_char when working with strings-that-you-want-as-dates or dates-that-you-want-as-strings respectively.
    Any time you store a date in the database, store it in DATE format - this gives oracle valuable information (eg. that it's a date and not just a string) which allows it to make decisions correctly when comparing them. Eg. '22/01/2009' is earlier than '14/02/2009' if the database knows it is a date, but is later if all the database sees is a string (14 being less than 22, of course).
    Anything that is already in date format, you do not need to change if you're using it in calculations (eg. select date_col_1 - date_col_2 from my_table , or sysdate) but any time you interact with the database to input a date or extract a date, you need to use to_date or to_char. (it's less important with the latter, if you don't really care how the date is displayed). Do not ever to_date() something that is already a date - you force implicit conversions of the date and that is a) pointless and b) could cause bugs in your code.
    Even the experts sometimes get caught out with dates, when they rely on implicit conversions!

  • Default data format (localization)

    It's actually one for the Report Builder forum but I couldn't find that so sorry.
    I wondered if anyone knew of a way to have the default localization set to en-GB (UK dates, rather than US dates). The scenario is this;
    I open report builder 3.
    Set up a datasource and data set in the query designer, if I return a date column it is in the UK dateformat (if I click execute to preview the data).
    However when I drag columns on to a table and then run the report the dates are in a US format.
    To correct this I have to then edit my localisation for the column or I can do it for the whole report to be en-gb and this works.
    However is there a way to have it default to en-gb so I don't need to do this modification with each report. Firstly I thought it was using my PC localisation settings but these are UK, then I wondered if there was something I could set in the Report Builder
    manifest or alike?
    Thanks,
    Nic

    Hi,
    Just as an update to this I believe we may have resolved it by doing the following;
    1. Logging on to the Report Server as the service account used by SQL/SSRS.
    2. Opening IE and then selecting Internet Options>Languages.
    3. The 'Language Preferences' show a box saying 'Set Language Preferences', clicking this loads the language window in control panel.
    4. I then clicked 'options' and downloaded the language pack (it automatically detected the machine is in the UK region and so downloaded the en-GB pack).
    5. The machine should then be restarted and I logged in again as the service account and repeated sets 1,2 and 3 and then double clicked on 'English (United Kingdon), this took me to another window which said it was enabled.
    6. The date formats in the report are now being returned correctly. I need to check this on our UAT server but initially it all looks good.
    So it was a missing language pack that has resolved this issue.
    Regards,
    Nic

  • Convert the date into user default date formate

    I am wrinting a bdc and i want to convert the date into user default date farmate ..please suggust the functiom module should i use...

    actually by using dats or d type you can get the user specific date itself.
    but if u have different dates format that need to be converted to the user specific date then you can follow below procedure
    1. retrieve the user format from usr01
        SELECT SINGLE datfm
          INTO w_datfm
          FROM usr01
         WHERE bname EQ sy-uname.
    pass w_datfm to the below FM (4th import parameter)
    2. create Z - FM and retrieve the user secific date
    FUNCTION ZFXX_USER_SPECIFIC_DATE.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(IW_DAY) TYPE  CHAR2
    *"     VALUE(IW_MONTH) TYPE  CHAR2
    *"     VALUE(IW_YEAR) TYPE  CHAR4
    *"     VALUE(IW_DATFM) TYPE  USR01-DATFM
    *"  EXPORTING
    *"     VALUE(EW_USER_DATE) TYPE  CHAR0008
    *1  DD.MM.YYYY
    *2  MM/DD/YYYY
    *3  MM-DD-YYYY
    *4  YYYY.MM.DD
    *5  YYYY/MM/DD
    *6  YYYY-MM-DD
    CASE iw_datfm.
      when '1'.
        concatenate iw_day iw_month iw_year
               into ew_user_date.
      when '2'.
        concatenate iw_month iw_day iw_year
               into ew_user_date.
      when '3'.
        concatenate iw_month iw_day iw_year
               into ew_user_date.
      when '4'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when '5'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when '6'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when others.
        clear ew_user_date.
    endcase.
    ENDFUNCTION.

Maybe you are looking for

  • Saving multiple records at a time like the way it's done in picklist

    I've to make a form using two T lists like the way it's done in picklist. The user can move elements either one by one or all at a time from one side to another and then save the record. I've made the basic thing using two t lists. But i'm unable to

  • How to determine which albums are available in AAC 256kbps?

    Hi, I've uploaded all my iTunes library in iTunes Match and now I'd like to delete my low-quality MP3s to re-download AAC 256kbp songs from iTunes Match.. my problem is how can I understand if one of my uploaded albums has been uploaded in my low-qua

  • Moving Home, line still active in another name.

    I am moving home and trying to have a phone line connected. However, BT say that the phone line is still 'active' at the premises and the previous occupant will have to be contacted to have the line deactivated. Here's the rub, the previous occupant

  • Synchronizing data from two folders

    It would be nice to be able to synchronize the description and keyword fields(possibly others) from two folders containing the same images(file numbers, different extension). I keyword my images right after importing in Bridge and then convert them t

  • Dimensions: Key and Description by default

    Hi All, is there any chance to have Kex and Description of selected dimensions by default ... even in new reports? After changing this in the Query Designer for selected InfoObjects this isn't recognized by SPM. Every Dimension has Only Description b