Date Format in PeopleSoft Query Expressions

Hello,
I have devloped a query where one of the field has date field. The format that's showing is 'MM/DD/YYYY'. We want the format in 'MM-DD-YYYY'. I tried to create a expression using to_char(A.fieldname,'MM-DD-YYYY'). But its not working. Is there any other way we can get the format in 'MM/DD/YYYY' from query manager.
Thanks,
-Sam

Hi Sam,
PS Query will automatically wrap date fields in the select list with TO_CHAR(...,'YYYY-MM-DD'), even in an expression. However, it only does this when the fieldname includes the alias, so in your expression you could use
to_char(fieldname,'MM-DD-YYYY') (no A.) as long as it doesn't cause an ambiguous reference (i.e. there are no other tables in your query with "fieldname" as a column). Otherwise, you could write your expression to convert the TO_CHAR result back to a date and then use TO_CHAR again. i.e.
TO_CHAR(TO_DATE(A.fieldname,'YYYY-MM-DD'),'MM-DD-YYYY')If you look at the resulting SQL, this will become
TO_CHAR(TO_DATE(TO_CHAR(A.fieldname,'YYYY-MM-DD'),'YYYY-MM-DD'),'MM-DD-YYYY')which should give the desired result.
Regards,
Bob

Similar Messages

  • Date format in BI query

    Hi,
    We need to display a single date format independent of date format of SAP User settings. For ex: as below.
    In a current query the  date, depending on the user's configuration could appear as:
    dd.mm.yyyy (English format)         or        yyyy-mm-dd (Swedish format)        or        mm.dd.yyyy (American format)
    I need to change some of the queries date format as below.
    a) Change all dates in query outputs and parameters to the format YYYYMMDD
    b) Change all months in query outputs and parameters to the format YYYYMM
    c) Change all financial periods in query outputs and parameters to the format YYYYPPP
    Thanks,
    Jitu

    Hi
    I think u have to use the ABAP code at the query level.
    First take the date in one variable zdate_var  and then if u want the below , then
    data : zdate_var_year type d,
               zdate_var_mm type d,
              zdate_var_dd type d.
    zdate_var_year = zdate_var(4).
    zdate_var_mm = zdate + 4(2).
    zdate_var_dd = zdate + 6(2).
    YYYYMM = zdate_var_year , zdate_var_mm.
    LIke this u can have ur o/p as per ur wish,
    Hope u got it ,
    Thanx & Regards,
    RaviChandra

  • Date Format in a query of (attribute Object)

    Hello to all experts and BW users,
    I have question regarding the format of a date characteristic in my query.I was wondering if it is possible to show a date field in the following substraction: 31/12/2006 in 2006.
    I want to change the format(dd/mm/yyyy)in(yyyy)
    The query (report) will show you the lease contract expiries in the future. Example:
    NB   Year
    9    2006
    8    2007
    4    2008
    Many thanks in advance!
    Boyke

    Hi,
    I think there are two possible ways to do it - 
    1. manage it in Query (BEX) with VBA Macro
    2. add Calyear to your cube & let its value be determined automatically from 0calyear & use it in query.
    hope it helps.
    regards
    VC

  • How to convert milliseconds to date format in sql query

    Hi All,
    The following code is in java.     
    String yourmilliseconds = "1316673707162";**
    Date resultdate = new Date(Long.parseLong(yourmilliseconds));
    could you plese tell me how to convert milliseconds into date format in query and comparing with another date like(sysdate-3)

    Hello,
    http://stackoverflow.com/questions/3820179/convert-epoch-to-date-in-sqlplus-oracle
    Regards

  • How i can change date format in the query

    I have made a query and Document date format is DD/MM/YYYY but i want Document date Format as YYYYMMDD. Please help me out as soon as posible.
    Thanks is advance.

    Hi Harman,
    By default query shows same date setting what is maitianed in SU01 (user maintenance). User can set the dates as they want. Ask user to log in BI system and go to system> User Profile> Own Data. They can select the date format and save the changes.
    If you want to display same setting for all user, please select the format whenever you create any users and change for existing users.
    Regards,
    Kams

  • Change date format in reporting (query)

    I need to change date format from dd.mm.yyyy to dd/mm/yyyy in reporting (query)

    Hi Suresh,
    Go to transaction su01d in that enter your user.
    Now go to defaults and change the date format.
    Ya but this format will be user specific, so if you want everyone to see that format you have to change it for all.
    Regards
    Mansi

  • Date formats in BI Query designer

    Hi gurus
    We have enhanced our cube 0sd_co3 where we have taken a number of dates such as Railway Receipt date, Actual Goods Issue date, LFdat, thses are only few examples. Now our reporting scenerio demands reporting based on thses dates as given in our time dimensions such as
    YYYYMM        Qty
    but not based on the date mapped in the time dimension in the cube. but based on these dates
    in oracle we have the to_char function through which we change the format of date while writing sql query
    so if there is any option of changing date format in query without changing the modelling
    Pl suggest
    Thanks
    Shivani

    Hi,
    You can create new characteristic of char number 6 . Include it in the data target. Populate it via a update rule ( Routine).
    Use input as standard date (Railway Receipt date) and then pass the value to the new char in the required format (YYYYMM). Follow same thing for other dates also.
    Let me know if you have doubt.
    Regards,
    Viren

  • Date format at the query

    hi
    Can  You Please suggest how minimal we can correct this at the query output
    My coming output for the date field at the query is
    01/28/2008
    04/27/2006
    06/1/2006
    05/16/2006
    Desired Output for the query field at the query is
    1/28/2008
    4/27/2006
    6/1/2006
    5/16/2006
    Zeroes should not be present can you quickly help me in this regard

    Hi
    Check conversion routine on info object maintainance .
    Regards,
    Chandu.

  • 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

  • Problem with date format in select query

    Hi
    I am caught by a stupid problem, please help me
    I am writing a queries
    SELECT * FROM VOUCHERS WHERE VDATE = '07-AUG-08'
    SELECT * FROM VOUCHERS WHERE VDATE = '07-AUG-2008'.
    both are working fine in SQL Developer but returning error when called from JDBC Driver.
    First query doesn't return any record while it is supposed to
    Second returns error: ORA-01858: a non-numeric character was found where a numeric was expected
    What i remember, at least second query was working previously but what happend, i dont know
    i didn't change Oracle default datetime format or any other defaults
    Message was edited by:
    W-S

    It is a common issue most people don't realize what Oracle does with a query like this. You're comparing strings to dates. Use TO_DATE to convert your string '07-AUG-08' to a date. If you don't, you tell Oracle to convert the string to a date by itself. It may work sometimes but like you've experienced, it is not a very robust or elegant approach.
    Try something like this:
    SELECT *
    FROM vouchers
    WHERE VDATE = TO_DATE('07-AUG-2008','DD-MON-YYYY').You can even provide a third parameter to TO_DATE, but it's less frequently used. I let you figure it out.
    And a tip: the "urgent" keyword might act against you.

  • Checking correct data format using sql query

    1) I got column date of joining which accepts date in below format
    DD-MON-YYYY
    DD-MON-YY
    MON-DD-YYYY
    MON-DD-YY
    Month DD,YYYY
    Question:- how do i check whether all dates in Date of joining column are in above format or not using sql query?
    2) I got one more date column which accepts date in below format
    MMDDYYYY
    YYYYMMDD
    MM/DD/YYYY
    MM/DD/YY
    YYYY/DD/MM
    Question:- how do i check whether all dates in date column are in above format or not using sql query?
    sorry if it is a very simple question since I am new to sql and trying to learn ......Thanks for the answers from the group............

    In short, NO, it's not possible.  If you store dates correctly in the database as DATE datatype then you don't have this problem.  If you store them as VARCHAR2 you have a problem.
    So, you get a date of 20092012
    Is that 20th September 2012?  or is it 20th December 2009?
    What about...
    11-Jan-12
    Is that 11th January 2012 or 12th January 2011?
    Dates should never be stored on the database as strings.  That is why Oracle gives you a DATE datatype so you can store them properly.
    Also, when dates are passed from an application to the database, the application should be passing them as DATE datatype, and the application interface should be designed to accept dates from the user in a format specific to their country/locality and it would then know what that format is and automatically convert it to a DATE datatype before it gets anywhere near the database or any SQL.

  • Oracle 10g - Date format in SELECT query for CFOUTPUT

    Hello, everyone.
    The project that I am working on in the dev environment is connected to an Oracle 11g database, but the production side is Oracle 10g.
    I have a page that is erroring in production (but not development) when it gets to a date that it needs to display.
    A co-worker mentioned that, in 10g, if a date/time is being SELECTed, you have to put it in to_char(), so I did that.
    But it's still erroring, and I'm not getting an error message, so I'm assuming that I have an incorrect format for the date in the SELECT.
    What is the proper format for SELECTing a date/time when using to_char()?  Right now, I have SELECT to_char(create_date,'MM-DD-YYYY HH:MI') FROM tableA .  Is this not correct for CF to output?
    Thank you,
    ^_^

    Please see my original post ("I have a page erroring in production (but not in development) when it gets to a date that it needs to display.")  Sorry if it came across as vague.  It made sense, to me, when I typed it.  But, then, I'm usually typing fast just to get the question out there, when I'm in a hurry.
    Haven't done a CFDUMP, yet, as every time I make a change in development that needs to be tested in production, I have to notify my supervisor that there are files that need to be copied into production, which can sometimes take a while, so I try to do troubleshooting on dev side - it's a pain in the you-know-what, but that's the kind of environment I'm working in.
    As it turns out, changing the format in the SELECT to_char() did the trick.  If anyone else has this issue with Oracle 10g, I'm now using SELECT to_char(create_date,'YYYY/MM/DD HH:MI') FROM tableA, and now the CFOUTPUT is processing the whole page.  I guess the MM-DD-YYYY threw CF into a tizzy, breaking the process?
    Anyhoo, it's working, now.  Thank you, Dan and Adam, for your thoughts on this.
    ^_^

  • Date formatting in sql query

    hi,
    plz need hpl for this
    i have this query :
    q = "select count(*) from logs where dateLog=current_date";i have a logs in this current date but i havn't any data output ?

    Show us more of your code, please--especiall the spot where you read data from the ResultSet.

  • DATE FORMAT (ORACLE PORTAL) -----   (DATABASE)

    I had a conversion ERROR while I was inserting DATE value from
    dynamic LOV to database(probably because of the different
    default DATE FORMAT of LOV query and database). I fixed the
    problem with TO_CHAR funtion in the LOV query,where I changed
    the date format...
    But the ERROR could appear again if application was running on a
    different database. What can I do to dynamically change the DATE
    FORMAT, depending on the DATABASE???

    Put this code in advanced pl/sql block beofre displaying page
    dbms_session.set_nls('nls_date_format',
    '''MM/DD/YYYY''');
    set date format that you want.....

  • OIM11gR2: Changing Default Date format in calendar input

    Hi Experts,
    There are certain OOB fields in OIM like "Hire Date", "Provisioning date" that accept input from calendar control.
    I could see the default input format is like MM/DD/YY (eg: 12/13/12) when i click on calendar icon and select any date range
    But i want the functionality like if i select a date from calendar it should get populated as "MMM dd, yyyy" eg (Dec 13, 2012) in text box.
    Please help me out!!
    thanks in advance.

    Apologies... when I read the question through the first time I didn't work out that you were using the query window inside the Deverloper Tools for Visual Studio .NET. The OracleGlobalization object would be used in .NET code.
    I don't know a way to override the date format in the query window other than doing a to_char() on the date in the query.
    Something like:
    select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') from dualSorry about that,
    Mark

Maybe you are looking for

  • How can I link two frames via a button on one of the frame?help Plz

    Ok,here is the problem. I got two fully working java frames,each has different funcion. On one of the frames(my home Frame" Frame 1" ) i got a button called "Add User", when i press it i should then get my other frame(Frame2) to popup/run. in Frame1

  • ADF Tree setting focus back to parent node after deletion of child node

    Hi, Is there a way to get the focus back to the parent node (or rather any particular node) in a tree? I have a use case where we need to get the focus back to the parent node after a child node is deleted. Currently the focus is shifted to the next

  • Why is the color offset on Flash Player in my Firefox, even after reinstalling both Firefox and Flash Player?

    I have the latest version of Flash Player, the latest version of Firefox and my system is a Windows 7 64-bit. Every time I view a Flash Player window, the green color is offset down about one-quarter of the window. This makes it difficult to use Fire

  • Problems with external speakers

    After using external speakers for a couple weeks i have not been able to switch back to my internal speakers. I am new to apple but i looked at the system preferences and it says there is a digital output but that it has no output controls. Also ther

  • Target a frame in a movieClip

    I have buttons in a movie clip which are placed on the main time line. I also have movieclips placed on single frames (25, 30, 35, etc) on the main time. When a button is released I want two things to happen - - the playhead to go to a frame on the m