FM to get the number of days in Year,month and days by giving number of day

Hi ALL,
This is quit differnt.
I need to give input the 'start date' and the 'number of days' and get the total days from the start date in year,month and day format.
for example.
start date :01.01.2009
number of days as 32
then i should get
years:0
months :1
days :1
Pleas help me out.

hi Anusha,
first u pass the date and the days to the following fm you will get the result date....
data:date type sy-datum,
      r_date(10) type c.
date = sy-datum.
CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
   DAYS              = '32'
   MONTHS            = '0'
   START_DATE        = date
IMPORTING
   RESULT_DATE       = r_date
write:/ r_date.
then you need to pass the result date and the date to the following fm to get the required output...
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
    EXPORTING
      date1                   = r_date
      date2                   = date
    IMPORTING
      years                   = v_years
     months                 = v_months
    days                     = v_days
    EXCEPTIONS
      invalid_dates_specified = 1
      OTHERS                  = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
here u will get the difference in days,  months and year...
i hope u wil get help from this...
regards
Ashu  Singh

Similar Messages

  • How to get date difference in terms of years,months and also days

    Tool : Eclipse
    Framework : JSF & Springs
    JRE : jdk1.5.0_06
    Iam using oracle 10G DB as back end.I have two date fields in a table.
    1)premium_paying_start_date
    2)premium_paying_end_date
    Iam getting these two dates from the database and storing these values within a entity.Now in the delegate layer,
    i have to get the premium_term i.e, the difference between the two dates(premium_paying_end_date-premium_paying_start_date).
    The difference should show the year,month and no of days difference.
    For example :
    premium_paying_start_date : 14-10-1984
    premium_paying_end_date : 01-03-2008
    Difference should be : 23 Y : 4 M : 15 D (Y = years, M = months , D= days)
    So please give me the solution for this.

    Difference should be : 23 Y : 4 M : 15 D (Y = years, M = months , D= days)
    So please give me the solution for this.How did you determine what the difference should be?
    ~

  • How to convert days to years, months and remaining days

    Hi All,
    I have the number of days for example : 398 days how to
    convert 398 days to number of years and number of months and remaining days
    like 398 days 1 year , 1 month and 2 days
    Regards
    rkrao

    e.g.
    SQL> select sysdate, sysdate - 1234 from dual
      2  /
    SYSDATE   SYSDATE-1
    09-AUG-06 24-MAR-03
    SQL> select trunc(trunc(months_between (sysdate, sysdate - 1234))/12) yrs,
      2  mod(trunc(months_between(sysdate, sysdate - 1234)), 12) mnths,
      3  sysdate - add_months((sysdate - 1234), trunc(months_between(sysdate, sysdate - 1234))) dys
      4  from dual
      5  /
           YRS      MNTHS        DYS
             3          4         16
    SQL>

  • I need the age to show in Years Months and Days

    Post Author: LOgle0917
    CA Forum: Formula
    NumberVar DoBVar := IIF((100 * MONTH({CHARTING.CHARTINGDATE}) + DAY({CHARTING.CHARTINGDATE})<(100 * MONTH({DEMOGRAPHICS.BIRTHDATE})+ DAY({DEMOGRAPHICS.BIRTHDATE}))),1, 0);NumberVar MthVar := (DATEDIFF("m",{DEMOGRAPHICS.BIRTHDATE},{CHARTING.CHARTINGDATE}) - DobVar) MOD 12;NumberVar YrsVar := DATEDIFF("yyyy",{DEMOGRAPHICS.BIRTHDATE},{CHARTING.CHARTINGDATE}) - DobVar;StringVar MthYrs := TOTEXT(YrsVar,0) + " years " + TOTEXT(MthVar,0) + " months";
    This returns Years and Months what do I need to add to it to return days?
    Thanks!

    Post Author: SKodidine
    CA Forum: Formula
    Here is a formula that I modified for CR from a Visual FoxPro function by Ramani Subramanian G.
    Create a separate formula to replace your calculations for datediff and paste this replacing the values of fromdate and todate with {DEMOGRAPHICS.BIRTHDATE} and{CHARTING.CHARTINGDATE} respectively.
    DATEVAR FROMDATE := DATE(2000,01,01);   // FROM DATE
    DATEVAR TODATE   := CURRENTDATE;        // TO DATE
    NUMBERVAR YEARS;
    NUMBERVAR MONTHS;
    NUMBERVAR DAYS;
    STRINGVAR DIFF;
    DATEVAR   TEMP;
    IF TODATE < FROMDATE THEN
    (TEMP     := TODATE;
    TODATE   := FROMDATE;
    FROMDATE := TEMP);
    YEARS := DATEDIFF('YYYY',FROMDATE,TODATE);
    IF YEARS > 2 THEN
    (YEARS := YEARS - 2;
    TEMP  := DATE(DATEADD("M",YEARS * 12,FROMDATE));)
    ELSE
    (YEARS := 0;
    TEMP  := FROMDATE);
    WHILE TRUE DO
    (TEMP := DATE(DATEADD('M',1,TEMP));
    IF TEMP > TODATE THEN
        EXIT WHILE;
    MONTHS := MONTHS + 1);
    DAYS := DATEDIFF('D',DATE(DATEADD('M',-1,TEMP)),TODATE);
    IF MONTHS > 12 THEN
    (YEARS  := YEARS + INT(MONTHS/12);
    MONTHS := MONTHS MOD 12);
    DIFF := IIF(YEARS>0 ,TRIM(TOTEXT(YEARS,0)) & " YEARS " ,"0 YEARS ") &
            IIF(MONTHS>0,TRIM(TOTEXT(MONTHS,0))& " MONTHS ","0 MONTHS ")&
            IIF(DAYS>0  ,TRIM(TOTEXT(DAYS,0))  & " DAYS"   ,"0 DAYS");

  • How to get the difference of two dates in years,months and days

    Hi friends,
    how to get the difference of two dates in years,months and days
    for ex 2 years 3 months 13 days
    select (sysdate-date_Start) from per_periods_of_service
    thanks

    Something like this...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('17-nov-2006','dd-mon-yyyy') as c_start_date, to_date('21-jan-2008','dd-mon-yyyy') as c_end_date from dual union all
      2             select to_date('21-nov-2006','dd-mon-yyyy'), to_date('17-feb-2008','dd-mon-yyyy') from dual union all
      3             select to_date('21-jun-2006','dd-mon-yyyy'), to_date('17-jul-2008','dd-mon-yyyy') from dual
      4             )
      5  -- end of test data
      6  select c_start_date, c_end_date
      7        ,trunc(months_between(c_end_date, c_start_date) / 12) as yrs
      8        ,trunc(mod(months_between(c_end_date, c_start_date), 12)) as mnths
      9        ,trunc(c_end_date - add_months(c_start_date, trunc(months_between(c_end_date, c_start_date)))) as dys
    10* from t
    SQL> /
    C_START_D C_END_DAT        YRS      MNTHS        DYS
    17-NOV-06 21-JAN-08          1          2          4
    21-NOV-06 17-FEB-08          1          2         27
    21-JUN-06 17-JUL-08          2          0         26
    SQL>But, don't forget that different months have different numbers of days, and leap years can effect it too.

  • I reloading LR onto a new lap top.    I have the orginal LR 1 disk with correct Serial #.   I have downloaded it,  every time I try to open the program I get the "Do you want to buy or I have a Serial Number Page".    I fill out the page include the seria

    I reloading LR onto a new lap top.    I have the orginal LR 1 disk with correct Serial #.   I have downloaded it,  every time I try to open the program I get the "Do you want to buy or I have a Serial Number Page".    I fill out the page include the serial # accept terms and enter.   All fine and good seems normal.  When I try to open LR I get the damn "Do you want to buy" page.   I do I get past this BS?

    What version of LR are you trying to activate? A serial number for LR 1 will not activate LR versions 2 - 5, but it will enable you to purchase LR 5 at the upgrade price and activate it.

  • I can not get the new updates because my start disc and hard drive are full, I need 1.98 GB.

    I can not get the new updates because my start disc and hard drive are full, I need 1.98 GB.

    Some folks recommend OmniDiskSweaper to allow you to review your stuff to find possible candidates to throw away.
    Even if you throw away some stuff and your desired "1.98GB", then what?  If that's the number you need for the update, you'll just use most or all of the reclaimed space with the update and you are right back to where you started.
    You don't specify what kind of machine you got but presumably it's a mac pro since you posted in the Mac Pro community.  In which case just get yourself another drive or two and move stuff around to free up your boot drive.
    [Perhaps you should hurry too since I expect hdd prices might be going up due to possible impending hdd shortages.]
    Finally, if some of those updates are major system updates you want extra drives for backups because I always recommend you never do major updates to your system without backups to that system.

  • I just noticed that some of the movies I had in iTunes did not get transferred to the iPhone. The missing movies are shown as generic movie icons in the iTunes panel. How do I get the original movies to show up again and transfer to the iPhone?

    I just noticed that some of the movies I had in iTunes did not get transferred to the iPhone 5. The missing movies are shown as generic movie icons in the iTunes panel and are checked to select them. But they do not show up in iPhone Videos. How do I get the original movies to show up again and transfer to the iPhone? I recently upgraded Mac OS to 10.6.8

    1. iTunes won't offer cloud downloads for songs that it "thinks" are in your library, even if it "knows" the files are missing. If you've exhaustively searched for the missing files and there is no prospect of repair by restoring to them to their original locations, or connecting to new ones, then delete that tracks that display both the missing exclamation mark and are of media kind Purchased/Protected AAC audio file. Don't hide from iTunes in the cloud when asked, close iTunes, then reopen. You can download from the cloud links or iTunes Store > Quicklinks > Purchased > Music > Not on this computer > All songs > Download all.
    2. Why? Not sure, perhaps 3rd party tools or accidental key presses combined with previously hidden warning messages when trying to organize the library. There is a hint that using the feature to downsample media as it is synced to a device may also be involved, though I've not replicated it. Whatever the reason a backup would protect your media.
    tt2

  • I am trying to install flash player on my new Macpro hardrive.  It is downloaded but I get the continual message that my I.D. and password are wrong. Help please!

    I am trying to install my downloaded flash player on my new MacPro hard drive.  I get the continual message that my I.D. and password are wrong.  I know they are not wrong and have tried a lot of combinations from old Macs and old passwords too.  Nothing works.  How can I get the job done?

    Hi,
    On Mac, this password prompt is presented by your operating system, and is intended to keep you from accidentally installing software which can harm your system. Flash Player does not throw this prompt, Apple does that.
    Please provide machine credentials of currently logged in User to continue with the installation.
    Hope this helps.
    Thanks
    Piyush

  • I get the message 'itunes has encountered a problem and needs to close' when trying to open itunes 11.1.1.11. I have had to uninstall itunes so that I could load this version, the PC says it is correctly loaded, but I now cannot open itunes. Advice?

    I get the message 'itunes has encountered a problem and needs to close' when trying to open itunes 11.1.1.11. I had to uninstall itunes so that I could load this version as the update to version 11 kept failing. The PC says 11.1.1.11 is correctly loaded, but I now cannot open itunes. Any advice on how to get itunes working again?

    Hello there, ytnoj.
    Uninstalling and reinstalling iTunes can be a tricky endeavor and must be done in a very specific way. The following Knowledge Base article provides the step-by-step of the process:
    Removing and Reinstalling iTunes and other software components for Windows XP
    https://support.apple.com/kb/HT1925
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • How to get the most current file based on date and time stamp using SSIS?

    Hello,
    Let us assume that files get copied in a specific directory. We need to pick up a file and load data. Can you guys let me know how to get the most current file based on date and time stamp using SSIS?
    Thanks
    thx regards dinesh vv

    hi simon
    i excuted this script it is giving error..
       Microsoft SQL Server Integration Services Script Task
       Write scripts using Microsoft Visual C# 2008.
       The ScriptMain is the entry point class of the script.
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    namespace ST_9a6d985a04b249c2addd766b58fee890.csproj
        [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
            #region VSTA generated code
            enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
            #endregion
            The execution engine calls this method when the task executes.
            To access the object model, use the Dts property. Connections, variables, events,
            and logging features are available as members of the Dts property as shown in the following examples.
            To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
            To post a log entry, call Dts.Log("This is my log text", 999, null);
            To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
            To use the connections collection use something like the following:
            ConnectionManager cm = Dts.Connections.Add("OLEDB");
            cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
            Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
            To open Help, press F1.
            public void Main()
                string file = Dts.Variables["User::FolderName"].Value.ToString();
                string[] files = System.IO.Directory.GetFiles(Dts.Variables["User::FolderName"].Value.ToString());
                System.IO.FileInfo finf;
                DateTime currentDate = new DateTime();
                string lastFile = string.Empty;
                foreach (string f in files)
                    finf = new System.IO.FileInfo(f);
                    if (finf.CreationTime >= currentDate)
                        currentDate = finf.CreationTime;
                        lastFile = f;
                Dts.Variables["User::LastFile"].Value = lastFile;
                Dts.TaskResult = (int)ScriptResults.Success;
    thx regards dinesh vv

  • Is it possible in iTunes 11 to get the old album list view, with covers and track listings like in 10?

    Is it possible in iTunes 11 to get the old album list view, with covers and track listings like in 10?
    If not, then to me that is a huge retrograde step

    No, the old album list view is not an option in iTunes 11...
    You can restore much of the look & feel of the previous version with these shortcuts:
    ALT to temporarily display the menu bar
    CTRL+B to show or hide the menu bar
    CTRL+S to show or hide the sidebar
    CTRL+/ to show or hide the status bar (won't hide for me on Win XP)
    Click the magnifying glass top right and untick Search Entire Library to restore the old search behaviour
    Use View > Hide <Media Kind> in the cloud or Edit > Preferences > Store and untick Show iTunes in the cloud purchases to hide the cloud items. The second method eliminates the cloud status column (and may let iTunes start up more quickly)
    If you don't like having different coloured background & text in the Album view use Edit > Preferences > General and untick Use custom colours for open albums, movies, etc.
    If you still feel the need to roll back to iTunes 10.7 first download a copy of the 32 bit installer or 64 bit installer as appropriate, uninstall iTunes and supporting software, i.e. Apple Application Support & Apple Mobile Device Support. Reboot. Restore the pre-upgrade version of your library database as per the diagram below, then install iTunes 10.7.
    See iTunes Folder Watch for a tool to scan the media folder and catch up with any changes made since the backup file was created.
    tt2

  • TS1843 I am getting the following error messages- No DNS Server and Double SAT.  Can anyone walk me through a fix?

    Airport Express- No internet connection. I am getting the following error messages- No DNS Server and Double SAT.  Can anyone walk me through a fix

    Try putting these numbers in Network>TCP/IP>DNS Servers, for the Interface you connect with...
    208.67.222.222
    208.67.220.220
    Then Apply. For 10.5/10.6 Network, highlight Interface>Advanced button>DNS tab>little + icon.
    Might also put them in the Airport Express, no idea what Double SAT is!?

  • Hi my ipod touch 8gb won't turn on just get the apple sign in middle of screen and my laptop also can't find my ipod wen i plug it in? any help would be greatly appreciated thank you.

    hi my ipod touch 8gb won't turn on just get the apple sign in middle of screen and my laptop also can't find my ipod wen i plug it in? any help would be greatly appreciated thank you.

    OR use this method
    1. Press-hold the Home button (big circle below the screen)and the Sleep/Wake button (on top of the iPhone) simultaneously.
    2. Continue holding both buttons (Ignore the"Slide to power off") until the iPhone shuts off and begins to restart.
    3.You may let go when you see the silver Applelogo.
    Thats all Folks!!

  • How do I get the Itunes Music Library to stop showing and asking me to purchase the songs I have drug in for playlist?

    How do I get the Itunes Music Library to stop showing and asking me to purchase the songs I have drug in for playlist?

    If I make a playlist of my favorite Sax players by dragging there songs from their homepage into my playlist not purchasing them.  Those songs appear along side my regular songs in my overall music library with option to buy them.  The only way to get rid of them in my Music library seems to be to delete the playlist.

Maybe you are looking for