Date format changes in the middle of a program execution

In my C code I have a series of select statements.
When I first get a session to the database I use the following command to set the date format
alter session set nls_date_format = 'MM/DD/YYYY HH24:MI:SS'
It works fine for a few queries. After a while during the program execution I see that the date format changes to 'DD-MON-YY' format. This results in a series of error in my code because I expect the date format to always be in the 'MM/DD/YYYY HH24:MI:SS' format.
Any idea why the date format should change all of a sudden in the middle of the program execution.

I second the idea that you should always use TO_DATE and TO_CHAR if you want to reliably convert between dates and strings.
Without seeing your code, it is hard to say why your date format is changing, but the most likely reason is that you are changing users somewhere in the code. For example:
SQL> show user
USER is "OPS$ORACLE"
SQL> SELECT sysdate FROM dual;
SYSDATE
11-JUL-2003
SQL> ALTER SESSION SET nls_date_format='dd-Mon-yyyy hh24:mi:ss';
Session altered.
SQL> SELECT sysdate FROM dual;
SYSDATE
11-Jul-2003 10:15:12
SQL> connect jtest/test
Connected.
SQL> SELECT sysdate FROM dual;
SYSDATE
11-JUL-2003TTFN
John

Similar Messages

  • Date Format  changes in  the Reporting side..

    Hi friends,
    I have one date field that is Keyfigure (not a Time charecterstic) ...now i want to display date in DD- MON - YYYY format... but up to modelling side my date format is DD.MM.YYYY.....
    i dont want to change in modelling side.. because.. this required format is needed only for some querys ...
    so, can any one suggest me is there any chance to get the date format in the reporting side like this..(27-JAN-2007) ..
    helpful answers will be appriciated..
    Thanks
    Babu

    Hi Babu,
    If the format is required in the Bex analyser then its system dependent setting .
    Control panel - > Regional & language options -> Regional options -> Customize -> Date -> Short Date format -> DD-MMM-YYYY(Change) .
    Do not forget to log off and re-login into bex,execute queries and see the output.
    Hope that helps.
    Regards
    Mr Kapadia
    Assigning points is the way to say thanks in SDN.

  • Data format changing from database to datagridview

    hi I am trying to display data from database sqlite  to datagridview the data format changed automatically
    the date in database is
    2012-02-20 16:42:10.00 but on datagrid view it appears like  20/02/2012 16:42:10,
    swOut.Write(",");
    swOut.Write(dataGridView1.Columns[i].HeaderText);
    swOut.WriteLine();
    //write DataGridView rows to csv
    for (int j = 0; j <= dataGridView1.Rows.Count - 1; j++)
    if (j > 0)
    swOut.WriteLine();
    dr = dataGridView1.Rows[j];
    for (int i = 0; i <= dataGridView1.Columns.Count - 1; i++)
    if (i > 0)
    swOut.Write(",");
    value = dr.Cells[i].Value.ToString();
    //replace comma's with spaces
    value = value.Replace(',', ' ');
    //replace embedded newlines with spaces
    value = value.Replace(Environment.NewLine, " ");
    swOut.Write(value);

    This forum is for Microsoft products, they have already and endless quantity of databases, many even freeware. 
    Try therefore for your question the forums for SQLite.
    SQLite has very special own way of datatypes.
    Success
    Cor

  • How to Change Date Format according to the Locale/Country of Portal User

    Hi,
    In a webdynpro applicaiton, how to chage the  Date Format according to the Locale/Country of Portal User.
    Consider for INDIA: mm/dd/yyyy
    Consider for UK: yyyy/mm/dd
    So when i select the date from the Date Picker[input ui element bound to date context variable], the date format should be displayed accroding the portal users country/locale.
    Creating a simple type for every date format in the dictionary would not be the right solution.
    Please help.
    Thanks,
    Regards,
    Aditya Metukul

    Hi Aditya,
    Check out the following post in SDN and refer the
    Bertram's reply on the same topic.
    date format
    Regards,
    Shubham

  • Date format changed (since SP8?)

    Applied SP8 lately on a server. I guess since then the date format changed.
    It is now April 18, 2011,
    and it should be 18 April, 2011.
    I am not sure if this is because applying SP8, but what is for sure that the date format is not what we used to.
    Checked time zone. Regarding to `set time zone` it is proper (CET-1CEST).
    Please advise.

    Hi Marcel,
    Thanks for the fast reply. I will give it a try probably.
    I am still wondering what could have changed the date format.
    Originally Posted by Marcel_Cox
    I^d be suprised if it is really SP8 that changed your date format on the server console.
    In any case, the date format on the server console is controlled by the file lconfig.sys copied to the server's c:\nwserver directory at installation time.
    The following TID tells you how you can replace this file.
    Note that the TID refers to changing the code page. In your case, it is not the code page you want to change, but the country code which corresponds to the date format you want to display
    10093487: Convert existing NetWare server to different Codepages.

  • I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

  • View change in the middle of sessions to Windows 7 clients with OneDrive

    Some Windows 7 clients habe reported that the view changes in the middle of sessions to Windows 7 clients with OneDrive.
    For example they have been able to see image pictures as normal in the beginning of sessions and then suddenly only image names !

    Hi  yourDragonXi,
    Is it a desktop One drive or a web browser Onedrive content? According to your description, the should be a Sync process when you open the images, besides a screenshot will be helpful to find the explanation.
    Thanks and Regards
    Wade Liu
    TechNet Community Support

  • I have microsoft word for for my Mac book pro. When I open saved letters /documents on word the date automactically changes to the current date. How do I stop this happening? Many Thanks

    I have microsoft word for for my Mac book pro. When I open saved letters /documents on word the date automactically changes to the current date. How do I stop this happening? Many Thanks

    I suggest you post your qeustion on the Microsoft Mac forums as it's their software you're having issues with and that's where the MS experts hang out
    http://answers.microsoft.com/en-us/mac

  • I'm often having issues with clients not seeing or being able to open attachments, font formatting changes (on the pc end) and the inability to use HTML signatures to promote our company brand.

    I'm often having issues with clients not seeing or being able to open attachments, font formatting changes (on the pc end) and the inability to use HTML signatures to promote our company brand.

    I imagine your clients must be using Outlook, which is seriously broken when it comes to e-mail standards, especially HTML e-mail. You can work around the issues with Outlook by only sending plain-text e-mails and making sure that, in the Edit -> Attachments menu, the last two options are checked. Unfortunately, that means that HTML signatures are out.
    If you need something with a fancy layout, either attach a PDF file to the e-mail or include a link to a website in the e-mail.

  • List of Number format and Date format according to the Locales

    Hallo everyone.
    I am searching for a list or document which includes the number and date formats according to the country locales. Where can I find sort of document?
    Another question: Where can I find the all parameters of swing.properties file?

    "Date - allows the user to enter a date as a parameter. Note that the data type must also be "Date" and the format must be Java date format."
    Page 4-9, Adding Parameters and Lists of Values
    Oracle® Business Intelligence Publisher
    Report Designer's Guide
    Release 10.1.3.4
    Part No. E12187-01

  • Is there anyway to reset the GPIB driver during program execution?

    Is there anyway to reset the GPIB driver during program execution?

    The issue at hand is that a thread is executing a series of tests which may or may not be making GPIB calls at any given time. The thread may be killed at any time with the function CmtTerminateThreadPoolThread (due to the user pressing the stop button on the GUI). Cooperative thread termination is not an option since a test may cause the thread of execution to lock up the system. The problem is that there may be outstanding GPIB calls at the time that the thread is stopped. These calls time out and generate run-time errors usually via the GPIB function ibrd. The motivation is to completely stop the GPIB driver while the thread is being killed, after which it can be re-initialized. Ideally.

  • SSAS Cube parameter date format change

    Hi Experts,
    I am new to SSRS report creation. I have a parameter which is fetching date from cube. The date format from cube is YYYY-MM-DD.
    I want expression to change the date format to DD/MM/YYYY.
    I have used this expression - =Format(CDATE(Parameters!DimPromoUBUBStartDate.Value),"dd/MM/yyyy")
    but it is not working and getting the following error,
    "unable to cast object of type 'System.object[]' to type 'system Iconvertible'
    Please give your suggestions
    Thanks in Advance,
    Rajan

    Hi Rajan,
    According to your description, when you convert the "YYYY-MM-DD" formatted data from the parameter and change the format, it throw the error above. Right?
    In this scenario, the reason why you get this error because you set allow multiple values in that parameter. When we allow multiple values in a parameter, all select values will be put into a array when processing even you only select one value. And
    the CDate() function can't convert the object[]. So please unselect the allow multiple values in parameter. If you want to keep multiple values selection, you can only convert one element from the array. For example: CDate(Parameter!XXXX.Value(0))
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Date Format changes    in   Query Designer

    Hi friends,
              I have one  date field that is Keyfigure (not  a Time charecterstic) ...now   i want to display date in  DD- MON - YYYY format... but  up to modelling side my date format is DD.MM.YYYY.....
           i dont want to change in modelling side.. because.. this required format is needed only for some querys ...
       so, can  any one  suggest me is there any chance to  get the date format in the reporting side like this..(27-JAN-2007) ..
            helpful answers will be appriciated..
    Thanks
    Babu

    Hi,
    After logon to BW, goto SYSTEM at menu bar.select user profile --> select OWN DATA. You will get Windoe, in that goto default tab, there you change DATE FORMAT and save.
    If it useful assign points.
    Regards,
    sri

  • DATE format - while defining the table column

    Hi Friends,
    I came across a piece of code which was applying a TO_DATE() function on a date type column.
    I have two tables t1 and t2 and they have col1 and col2 columns respectively of type DATE
    t1
    col1 DATE
    t2
    col2 DATEalso there is a variable var1 and is defined as below:
    var1 DATE;now I have conditions as below in the code:
    AND to_date(t1.col1,'dd/mm/yyyy') = to_date(t2.col2,'dd/mm/yyyy')
    AND to_date(t1.col1,'dd/mm/yyyy') = to_date(var1,'dd/mm/yyyy')This code failed on Production with an error: ORA-01861 literal does not match format string
    I changed the code to remove TO_DATE() and it worked fine. Dev clarified that they used this function so that if the two columns or variable are in diff date format.,..they can be put in sync.
    e.g. if col1 is dd/mm/yyyy and col2 is mm/dd/yyyy then there will be an issue.
    My doubt is.. in a given environment if we are creating a table and defining a column of type DATE , or defining a variable of type DATE, can their format be different at any time? I think No.?
    In what scenario can the date format be different?
    Thanks,

    Having said that date format is only for display purposes, if you tend to avoid the error without changing the code then you can modify the NLS_DATE_FORMAT parameter at session level.
    SQL> alter session set nls_date_format = 'dd-mm-yyyy'
      2  /
    Session altered.
    SQL> select to_date(sysdate,'dd/mm/yyyy') from dual
      2  /
    TO_DATE(SY
    29-12-2008
    SQL> alter session set nls_date_format = 'mm-dd-yyyy'
      2  /
    Session altered.
    SQL> select to_date(sysdate,'dd/mm/yyyy') from dual
      2  /
    select to_date(sysdate,'dd/mm/yyyy') from dual
    ERROR at line 1:
    ORA-01843: not a valid month
    SQL> select to_date(sysdate,'mm/dd/yyyy') from dual
      2  /
    TO_DATE(SY
    12-29-2008Thanks,
    Karthick.

  • Why does the Canadian regional date format default to the US date format?

    I've discovered that on the iPad, iPhone and MacBook that choosing the Canadian Regional format results in the US date format of mm/dd/yyyy rather than the Canadian format of dd/mm/yyyy. I can use a custom format on the MacBook (but why do I need to??) but can't see how to change under settings on my iPad and iPhone.
    -Bob.

    In iOS8 anyone can now select the "Canadian English" regional setting and you will get dates in correct ISO 8601 YYYY-MM-DD format.  To confirm this is what you should use, check your Ontario Drivers License, OHIP health card or the bottom date on any federal gc.ca  webpage.  Yosemite is also the same. Thanks Apple, for having listened to Canada!
    (You might want to change Siri back to the American female voice from the British-sounding male voice.)

Maybe you are looking for

  • SAP Help Doc on Query Views in BW

    Hi   I am preparing Documentation.   Is there any SAP help document avaliable that explains what are VIEWs developed in Analyzer ....there filters...etc Thanks

  • "Other" section in iPhone 5 grows larger every time the device is connected to computer

    My phone's "other" section was getting unwieldy and I decided to opt for a fresh restore. After the initial bare bones setup, the other section starts at about 500 mb. I disconnect the phone from the computer and reconnect it. The other section seems

  • Sending pics in Apple mail to PCs

    Hi, I'm having trouble sending pics in Apple Mail that show up in the body of the text and not just as an attachment. People who get my emails with Apple Mail seem to see the pic in the body, but other users, especially PC users only see the pic as a

  • Error NO_RESOURCES when using Apache Plug-in for Weblogic

    Hi all, LoadModule weblogic_module modules/mod_wl.so    OS.....: OEL 6.3 64 bits    Weblogic Server: 12.1.0.2 (192.168.0.123)    Apache: Apache/2.2.15 (Unix) (192.168.0.149)    I am trying to configure the Apache Plug-in to forward the requests to th

  • How do you sync video wirelessly?

    Syncing potos via photostream is as easy as it gets...is there a similar method for syncing videos, either with iphoto or imovie?