Format of Extracted Year

Post Author: Dorothy
CA Forum: Formula
I cannot for the life of me get what is probably a very simple thing to work.  I have extracted the year from printdate as such,
Year({@PrintDate})  (by the way @PrintDate = PrintDate).  I have formatted Year as a number (1123).  When I put the Year in an if then formula
it prints out as 2,007.00.  Can anyone help me with this?  Please help soon.  I have another post that did not get answered "Return by Date Problem"

Post Author: SKodidine
CA Forum: Formula
Three things you can try:
1.  Depending on the result of the IF-THEN statement, try formatting it as a number just as you did for the Year.
2.  Use totext function to convert the result to text i.e. totext({@year},0,'','')
3.  Try changing the display string (right click, format field, common tab and x-2 next to display string) to display using totext as above.

Similar Messages

  • How do i extract year from a variable???

    Hi all,
    I want to extract year from a parameter.
    I tried the following, i'm getting errors.
    When I executed the below code,
    SELECT TO_CHAR(:X_PRM_YR_END_DT,'YYYY') FROM dual;
    I got the following error.
    ORA-01722:invalid number
    When I executed the below code,
    SELECT TO_DATE(:X_PRM_YR_END_DT,'YYYY') FROM dual;
    SELECT to_char(TO_DATE(:X_PRM_YR_END_DT,'YYYY')) FROM dual;
    I got the following error.
    ORA-01830: date format end before converting entire input string
    When I executed the below code,
      SELECT extract(YEAR FROM :X_PRM_YR_END_DT) FROM dual;
      SELECT extract(YEAR FROM 1/11/2013) FROM dual;
    I got the following error.
    ORA-30076: invalid extract field for extract source
    How do i extract year from a variable???
    Help me plz
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production.

    Try This,
    select TO_CHAR(to_date('01/01/1980','dd/mm/yyyy'),'YYYY') FROM dual;

  • Extracting year and date

    I am working on the following query
    SELECT report_date, EXTRACT (MONTH FROM report_date) FROM program_details;
    SELECT a.customer_id, a.report_date as change_date
    FROM program_details AS a
    LEFT JOIN program_details AS b
    on a. customer_id = b. customer_id
    AND EXTRACT (MONTH FROM a.report_date) = EXTRACT (MONTH FROM b.report_date) - 1
    AND EXTRACT (YEAR FROM a.report_date) = EXTRACT (YEAR FROM b.rpt_date )
    WHERE a.code_status = 'Gold' and b.code_status = 'Plat'
    AND a.report_date >= '2007-12-01 00:00:00.0'
    AND a.report_date < '2009-01-01 00:00:00.0'
    I have a table with customer id, yyyy-mm-dd for many years , and status as gold silver or platinum. and I need to work out the month that the status changed, and return a field as year-month.
    I am trying to extract the year and date that a customer changed from gold to plat but I am not sure how date arithmetic works. I need to have output like : customer_id and year-month but I keep just getting month.
    I know this is vague, but if you could help with the part of the query that delivers year and month back that would be great.
    Thank you very much

    Hi,
      1  SELECT a.customer_id, to_char(a.report_date, 'yyyy-mm') as change_date
      2* FROM program_details a
    SQL> /
    CUSTOMER_ID CHANGE_
              1 2009-06Bartek

  • How to extract year alone form a given date

    Hi all,
    How to extract year from a given date alone.
    eg: 01/01/2000.
    i want 2000 separately. How can i do that?
    Plz help me regarding this.
    Thanks & Regards,
    vineel

    Hi Vineel,
    You can use the first four chars of the date field..
    w_year = w_date(4)
    Else, you can use the FM:
    GET_CURRENT_YEAR
    Thanks and Best Regards,
    Vikas Bittera.
    **Reward if useful**

  • Extracting Year from the date field

    Hi,
    I want to extract year from the date field... I've tried following code but got the error
    SELECT to_char(a.A_EXPIRY_DATE,'yyyy') as EXP_YEAR from Table_A a
    Please advice
    Thanks in advance

    user12863454 wrote:
    SELECT to_char(a.A_EXPIRY_DATE,'yyyy') as EXP_YEAR from Table_A aThis should work and returns a string.
    What error did you get?
    maybe your column name is wrong? Is it really A_somthing? This is possible but slightly unusual.
    also possible
    select extract(Year from sysdate) from dual;
    /* with your table and column */
    SELECT extract(year from a.A_EXPIRY_DATE) as EXP_YEAR from Table_A a;Edited by: Sven W. on Aug 18, 2010 6:41 PM

  • Extract Year (only) from Date Field and Display in Text Field

    I need to extract the year from a user entered date field and display the year in a text field. Can someone help me with the correct script to do this?

    Hi,
    that's quite easy to realize with FormCalc.
    In you date fields exit event add the following code:
    textField1 = Num2Date( Date2Num($.formattedValue, "MM/DD/YYYY"), "YYYY")
    Note: This sample assumes that your date field formats the date with "MM/DD/YYYY". You may have to change the pattern to make it work at your end.

  • What is the best video format for 50+ year movie storage?

    Objective:  In what video format should I store my family movies on an external drive?  I want these family movies to be viewable by future generations in 50 - 70 years, so what video format / type is recommended?
    Background:  I have an iMac, OS X 10.7.5.  I use IMovie '11, version 9.0.8.  My iMac has an internal DVD player and burner and iDVD is installed.
    I have dozens of family movies (total 80+ hours) dating back nearly 70 years.  All these films have been digitized and I have imported many of them into iMove as events, then I edit them with title pages, transitions, music, etc.  When a "project" is completed (Between 1.5 - 2.0 hours or less) I share the project to iDVD where I burn it to a DVD.  Within iMovie I save each of these projects (on the internal Mac HD, which consumes very little space) and on an external drive I save for each project:
    - a disc image (DVD.img) whose size is about 4.5 GB
    - a copy of the iMovie project, whose size is about 60 MB (the original project is in iMovie, in the Mac internal drive)
    - the original digitized raw movies imported into iMovie as events and are formatted as .mov (these are large size at 8 GB - 20 GB each)
    - the finalized and fully edited iDVD which is formatted as DVD.dvdproj (these are very large size at 20 - 24 GB each)
    As you can see with all these disc images, projects, events and DVD projects stored on my external drive I am at nearly 1 TB of storage, on my way to 1.75 before I comple editing all movies.
    While I manage pretty well the editing my movies within iMovie, and how to create an iDVD project and then burn a DVD, I have no understanding of the technical aspects of the multitude of different movie formats in the market nor of Quick Time and its format.
    I am told that DVDs will only last 10 - 15 years and then begin to deteriorate.  And iMovie '11 won't be arond 50 years from now.  Nor will the current / recent versions of iDVD.  Thus, for posterity:
    1.  In what format should I store my family movies on an external drive so they can be viewed by family members 50 - 70 years from now? (best chance for viewing, since we don't know what formats they will have then)
    2.  How do I convert from what I have (disc image, iMovie project, DVD project) to your recommended format?
    Thank you,
    HDP

    There is no such format for movies or even Photographs. Frankly we can't guarantee the persistence of any format past the next 10 years, not to mind 50 - 70.
    Codecs are being improved and created all the time, and this process will continue. In 50 years time we may still have .mov and .avi files, but the codecs that create the movies within will have changed.
    One thing is reasonably sure: DVD will be as deader than floppy disks are now. Ditto Blue Ray. They're on the way out now, and in 10 years they'll be curiosities.
    So, what's the solution:
    Best I can suggest is to keep your movies on volatile media like Hard Disks (with back ups on other disks, or course). Progress will be evolutionary - as new formats come along there will be the option to migrate older data to these newer formats, and that's the trick. As always, when it comes to migration, the more data available the better the likely result, so keeping your movies in the least compressed versions possible seems a good approach.
    That and a dollar will get you a cup of coffee someplaces, but nowhere fashionable.
    Regards
    TD

  • Format for Fiscal Year Period 0FISCPER

    Hi,
    Im uploading the fiscal year period into BW infoobject 0FISCPER. Im uploading it in the format eg: 003.2005 but it is getting read into bw as 003.2000.
    Im using Excel/ CSV file and the field is converted to Text.
    Does anyone know what format I have to use to upload fiscal year period and get it in the format I want ?
    ie 003.2005 ?
    Regards,
    Dominic

    Hi Dominic,
    0FISCPER is a NUMC 7 infoobject. And it takes your 003.200 seven symbols leaving the last symbol. Though, the output format is length of 8.
    A'm not sure if you are dealing with external format (in this case try to enter 0032005) or with internal (then try 2005003).
    Best regards,
    Eugene

  • Convert date format from MONTH-YEAR to  dd/mm/yyyy

    Dear All
    i want to get parameter in form of MONTH-YEAR AND WANT TO CONVERT DATE INTO 'THIS FORMAT dd/mm/yyyy' IT GIVES ME ERROR PLEASE GUIDE.
    SELECT
    TO_CHAR (PTP.END_DATE,'MONTH-YY') ,
    to_date ( TO_CHAR (PTP.END_DATE ,'DD-MONTH-YYYY') ,'dd/mm/yyyy'),
    --- i want to gent parameter in from of MONTH-YEAR AND WANT TO CONVERT DATE INTO 'THIS FORMAT dd/mm/yyyy' IT GIVES ME ERROR PLEASE GUIDE
    to_date ( TO_CHAR (PTP.END_DATE ,'MONTH-YYYY') ,'dd/mm/yyyy'),
    ADD_MONTHS((to_date ( TO_CHAR (PTP.END_DATE ,'MONTH-YYYY') ,'dd/mm/yyyy'),-1)
    --- i want to gent parameter in from of MONTH-YEAR AND WANT TO CONVERT DATE INTO 'THIS FORMAT dd/mm/yyyy' IT GIVES ME ERROR PLEASE GUIDE
    ptp.END_DATE PERRIODS_NAME
    from per_time_periods ptp
    Regards
    Edited by: user10941925 on Nov 28, 2011 12:23 AM

    Hello just check
    SQL> select hiredate from emp;
    HIREDATE
    17-DEC-80
    20-FEB-81
    22-FEB-81
    02-APR-81
    28-SEP-81
    01-MAY-81
    09-JUN-81
    09-DEC-82
    17-NOV-81
    08-SEP-81
    12-JAN-83
    03-DEC-81
    03-DEC-81
    23-JAN-82
    14 rows selected.
    SQL> select to_char(hiredate,'month-year') from emp;
    TO_CHAR(HIREDATE,'MONTH-YEAR')
    december -nineteen eighty
    february -nineteen eighty-one
    february -nineteen eighty-one
    april    -nineteen eighty-one
    september-nineteen eighty-one
    may      -nineteen eighty-one
    june     -nineteen eighty-one
    december -nineteen eighty-two
    november -nineteen eighty-one
    september-nineteen eighty-one
    january  -nineteen eighty-three
    december -nineteen eighty-one
    december -nineteen eighty-one
    january  -nineteen eighty-two
    14 rows selected.
    SQL> select to_char(hiredate,'dd/mm/yyyy') from emp;
    TO_CHAR(HI
    17/12/1980
    20/02/1981
    22/02/1981
    02/04/1981
    28/09/1981
    01/05/1981
    09/06/1981
    09/12/1982
    17/11/1981
    08/09/1981
    12/01/1983
    03/12/1981
    03/12/1981
    23/01/1982
    14 rows selected.
    SQL>

  • Extract Year/Month/ Week From Date

    BW Experts,
      I have a Time Char in a New OSD i am developing. Say the Time char is 0Req_date. This 0req_date is updated using some calculation in my update rules (Say 0Req_Date = Act_dl_dt - Conf_date). Now I have to extract month/ year/ week and populate Time Chars 0REQ_MONTH, 0REQ_YEAR and 0REQ_WEEK respectively from 0REQ_DATE. Can I do this via respective rules to 0REQ_MONTH, 0REQ_YEAR and 0REQ_WEEK in the update rules. My concern is as OREQ_DATE itself is a calculated field, can month/year/week be extracted correctly? Hope I have put the question across understandably. Help is appreciated.
    Thanks
    Ashwin

    Hi Ashwin,
    It can be done...you can either put the code for all these derivations in the Start Routine of the update rule, making sure that the 0REQ_Date is calculated before the others. Or you can also calculate just the 0REQ_DATE in the start routine and use the individual update routines to populate the other time chars.
    Processing using the Start Routine is recommended for efficiency and better performance.
    Hope this helps...

  • Extract year from date

    Hello,
    Iam using obiee 11g, would like to extract the year from date
    CAST(YEAR("ABC"."DATEADDED" ) as varchar(4))
    so used like this
    But i want like if the year is 2011 then only 11 i wants is there a direct function which does that.
    Thanks

    You can use the right function right(year, 2). Will return 11 if year is 2011

  • Extract year from date and exclude Null

    I have a calculated column that will pull the year out of a date column:
    =TEXT([Date Impact Identified],"yyyy")
    This formula works fine but if the column is blank then it returns the value as 1899. I have tried several variations of ISBLANK or ="" but nothing has worked so far. I think I am putting the formula in the wrong order. Can anyone help?
    Thanks.

    Hello,
    In order to save you weeding through other threads, here's what should work in your scenario:
    =IF(ISBLANK([Date
    Impact Identified]),"",TEXT([Date
    Impact Identified],"yyyy"))
    cheers, teylyn

  • Help: Date Format Mask Issue year 0004 instead of 2004

    Hi,
    I set Date Format Mask as MM/DD/YYYY for a date field. However, when user enter
    12/31/04 the result turned out as 12/31/0004
    Of course, I'd like user put 12/31/2004, but 12/31/04 leads to 12/31/0004 has to be stopped.
    Any suggestions?
    Thank you in advance.
    Jimmy

    Thank you very much Francois and it works for me.
    Jimmy

  • How To Get Only Month or Only Year from datetime format of yyyy-mm-dd

    Hi SQL gurus,
    I have field has datetime format of yyyy-mm-dd (ie. 2014-11-28).  Could anyone please educate me on how to extract only month (ie. November but not 11) and only year (ie, 2014) from 2014-11-28.  I writing two report have title of Number of
    sick leaves on November  and Number of sick leaves in 2014.  I am planning to extact 11 from 2014-11-28 and display as November on report title and the same goes for 2014.  Unless you have better non complicated way.   Thank you
    very much in advance.  DingDong!!

    There are multiple ways
    Month name
    SELECT DATENAME(mm,@DateParam)
    SELECT FORMAT(@DateParam,'MMMM')
    Year
    SELECT FORMAT(@DateParam,'yyyy')
    SELECT DATEPART(yy,@DateParam)
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Extract a year from a date

    I have a date
     [Period Closed].[Period Closed] in a cube. This table contain only one values which might be  a certain date. Not today's date.
    I have another date table where I have to use the date value from [Period Closed].[Period Closed]  and pass in to another date table so that I can drive off all my data based on the date value. There is no hierarchy in [Period Closed].[Period
    Closed]  table. How can I extract year and month from [Period Closed].[Period Closed]  so that I can pass to main date table.

    Try something like this:
    StrToMember('[Other Date].[Other
    Date]&[' + Format(CDate([Period
    Closed].[Period Closed]), 'yyyyMMdd') + ']')
    This assumes that the key for [Other
    Date].[Other Date]
    is an integer with YYYYMMDD.
    Hope this helps.
    Reeves
    Denver, CO

Maybe you are looking for

  • ArrayList help indexing a string

    Basically for this project, I need the user to input a sentence and then i have to print out the different words with their index. For example if the user inputs the following: Hello Hello Hello World World World Hello The program should output: Hell

  • How To  Configure  Eclipse Theme Editor in NW 7.0 ?

    I have downloaded the new Eclipse Theme Editor .Can anyone provide me any link to any material which provides a <b>Step-By-Step guide to configure this into NW 7.0</b> ?

  • RE: NT Server Reboot and Forte Partitions[Ref:C943460]

    Hi Bradley. At our customers, we need one of our Forte applications to be running for data communications to take place. After a reboot, we need this application's partitions to come online. The way we did this (as you suggested) was to use a BAT fil

  • How to block pop ups gone wild..???

    how to block pop ups on my macbook pro.? i been experiencing this since 1month now got tired of it!!!

  • Customer Advance Payment

    I have a business scenario and I don't know the best way to implement it. My client receives an order and creates a Sales Order. The customer has to make the advance payment. Once the payment is made, outbound delivery is made and goods are issued. I