Leap year check

I have a class called Date and this method:
private boolean dateOK(int dd, int mm, int yy)
return ( (dd >= 1) && (dd <= 31) &&
(mm >= 1) && (mm <= 12) &&
(yy >= 0000) && (yy <= 9999) );
How can i check the date is ok if it is a leap year?

public static boolean isLeapYear(int year) {
          if(year % 4 != 0)
               return false;
          if(year % 100 != 0)
               return true;
          if(year % 400 == 0)
               return true;
          return false;
     }I could be wrong, but I think leap year didn't start until a specific date (1600 comes to mind), so it should take that into account.
Remember: Those whom don't understand how a saw
works, cut their own hand off
Message was edited by:
Lumantu

Similar Messages

  • Get previous year from leap year

    Hi all,
    I'm stuck here trying to get the previous year for the current year, I tried these function module but didn't work, CCM_GO_BACK_MONTHS and CALCULATE_DATE.
    The problem is, in the leap year, there's Feb 29th, so I want to get 1 year before the date I enter, 2008 is a leap year, when I entered feb 29th 2008, then used the FM, then it showed me Feb 29th 2007, but 2007 doesn't have Feb 29th.
    Any advice? thanks!

    Try                                                                               
    /SAPNEA/J_SC_CALENDAR          Calendar
    /SAPNEA/JSC_LEAP_YEAR          Leap year check between two date
                                                                                    EAU0
    ISU_LEAP_DAYS_BETWEEN_2_DATES
                                                                                    FF04
    FIMA_LEAP_DAYS_BETWEEN_2_DATES
                                                                                    FV02
    LEAP_DAYS_BETWEEN_TWO_DATES                                  
    You can also look at class "CL_HRSEN00_LEAP_DAY_TOOLS"
    ^ Saquib

  • How to check the leap year among the years of earning a new degree?

    Hi All,
    I've developed a report to print a report of emplyees who earn a new degree between tow dates entered by two user parameters.
    I've used this code to do that:
    SELECT ALL E.EMP_SID, E.EMP_FULL_NAME, E.FINANCIAL_NO
    (CASE WHEN E.qualification_sid = 1104 AND E.degree_sid = 8 THEN
    (TO_DATE(E.degree_DATE, 'DD-MM-RR')+(365*M.spe_per)+1)
    ELSE
    (TO_DATE(E.degree_DATE, 'DD-MM-RR')+(365*M.yea_per)+1)
    END)
    COMM_degree,
    FROM EMPLOYEESS E, DEGREES M
    WHERE (CASE WHEN E.qualification_sid = 1104 AND E.degree_sid = 8 THEN
    (TO_DATE(E.degree_DATE, 'DD-MM-RR')+(365*M.spe_per)+1)
    ELSE
    (TO_DATE(E.degree_DATE, 'DD-MM-RR')+(365*M.yea_per)+1)
    END)
    BETWEEN TO_DATE(:P_F_DATE, 'DD-MM-RR') AND TO_DATE(:P_L_DATE, 'DD-MM-RR')
    AND (E.degree_SID = M.SID)
    ORDER BY M.SID DESC, E.EMP_FULL_NAME
    Now there is a mistake in the data resulted for some employees who have leap yaers in thier earning yaers
    for example: an employee has a degree date of 01/10/2011 and the supposed earn of next degree is 01/10/2016 but the report gives it as 30/09/2016 because there is a leap year 2012 which has 366 days not 365 days as I count in the code!
    If there is any mysterious thing in the code please don't hesitate to ask about it!
    Plz how to solve this problem?
    Note: I'm using Reports 6i.

    HI
    tRY ADD_MONTHS(SYSDATE,12) - IN PLACE OF 365 DAYS
    IF ANY PROBLEM LET US KNOW

  • HELP! Files won't open and previously had Firefox icon instead of DW icons!  Leap Year thing?

    Hi!  I went to update my website, which I do every night before the first day of every month and all the files had a FIrefox icon instead of the usual Dreamweaver one.  I have shut down, reinstalled DW MX 2004 but the files still do not open.  The icons have now changed to DW but they are not opening with right click, opening from Applications folder, double clicking the file, from get info and open with DW.  I am stumped. HELP!  Need to update for March 1st.
    Is it something to do with Leap Year 29th Feb?  Checked the clock in preferences but can't see how this affects it.
    Firefox is always updated but the latest version does not seem to be as efficient as previous upgrades.  We installed Chrome as well.  Do they interfere with each other?

    Hi Ken
    I wish the 7.1 updater download had helped but it didn¹t.  All the files
    were backed up before the installation, which went fine.
    Mac 10.5.8
    We used Disc Warrior to defrag the hard drive, which did not make a
    difference.
    We recently started using Chrome, so now have 3 browsers in the dock,
    Safari, Firefox and Chrome.  Do they interfere in any way with each other?
    The files, which I hadn¹t touched for a month as I update on a monthly
    basis, initially had the Firefox icon.
    Below is the message to send to Apple, which did not go through their report
    system!  A little disillusioned with the service!
    Model: iMac9,1, BootROM IM91.008D.B08, 2 processors, Intel Core 2 Duo, 3.06
    GHz, 4 GB
    Graphics: kHW_NVidiaGeForceGT130Item, NVIDIA GeForce GT 130,
    spdisplays_pcie_device, 512 MB
    Memory Module: global_name
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8E),
    Broadcom BCM43xx 1.0 (5.10.91.22)
    Bluetooth: Version 2.1.9f10, 2 service, 0 devices, 1 incoming serial ports
    Network Service: Ethernet, Ethernet, en0
    Network Service: AirPort, AirPort, en1
    Serial ATA Device: WDC WD1001FALS-40K1B0, 931.51 GB
    Serial ATA Device: PIONEER DVD-RW  DVRTS08
    USB Device: Built-in iSight, (null) mA
    USB Device: Keyboard Hub, (null) mA
    USB Device: iLok, (null) mA
    USB Device: Apple Optical USB Mouse, (null) mA
    USB Device: Apple Keyboard, (null) mA
    USB Device: Deskjet 3840, (null) mA
    USB Device: BRCM2046 Hub, (null) mA
    USB Device: Bluetooth USB Host Controller, (null) mA
    USB Device: IR Receiver, (null) mA
    FireWire Device: d2 quadra (button), LaCie, 800mbit_speed
    Does not mean a thing to me.
    I am not late with updating the site, which is about New Zealand culture,
    month by month (www.englishteacher.co.nz). Probably only the third time I
    have been late since 2005. Not a huge amount of traffic, ~300 a month and
    free access to content but I would like to solve this problem.
    Could a reciprocal link have caused a problem?
    At my wits end.
    I really appreciate the help though.
    Cheers Yvonne
    From: Ken Binney <[email protected]>
    Reply-To: <[email protected]>
    Date: Wed, 29 Feb 2012 06:42:11 -0700
    To: Yvonne and Bill Hynson <[email protected]>
    Subject: HELP! Files won't open and previously had Firefox
    icon instead of DW icons!  Leap Year thing?
    Re: HELP! Files won't open and previously had Firefox icon instead of DW
    icons!  Leap Year thing?
    created by Ken Binney <http://forums.adobe.com/people/Ken+Binney>  in
    Dreamweaver - View the full discussion
    <http://forums.adobe.com/message/4236682#4236682>
    Not necessarily related, but did you also install the 7.1
    updater? http://www.adobe.com/support/dreamweaver/downloads_updaters.html
     Windows or MAC?
    Replies to this message go to everyone subscribed to this thread, not
    directly to the person who posted the message. To post a reply, either reply
    to this email or visit the message page:
    http://forums.adobe.com/message/4236682#4236682 To unsubscribe from this
    thread, please visit the message page at
    http://forums.adobe.com/message/4236682#4236682. In the Actions box on the
    right, click the Stop Email Notifications link. Start a new discussion in
    Dreamweaver by email
    <mailto:[email protected].ad
    obe.com>  or at Adobe Forums
    <http://forums.adobe.com/choose-container!input.jspa?contentType=1&container
    Type=14&container=2240>  For more information about maintaining your forum
    email notifications please go to
    http://forums.adobe.com/message/2936746#2936746.

  • Unable to generate the file report pdf on 29 february 2012 or during any leap year day...

    hii this is manab......
    sir/mam i have face the following error in 29 february 2012 for my overall company report .But i can easily get the
    report of another department on 29feb 2012....but when i try generate the overall report of my comapany then i find the errors
    REP-1401: 'cf_mc_prod_lyrformula': Fatal PL/SQL error occurred.
    ORA-01839: date not valid for month specified
    The following is the logfile.........
    ...........................................................................................log file................................................................................................................
    HPCL Custom Application: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    HPCCMDS module: HPC Modified CMD Report
    +---------------------------------------------------------------------------+
    Current system time is 04-SEP-2013 11:37:20
    +---------------------------------------------------------------------------+
    +-----------------------------
    | Starting concurrent program execution...
    +-----------------------------
    Arguments
    P_MILL='NPM'
    P_TRANSACTION_DATE='2012/02/29 00:00:00'
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.US7ASCII
    REP-1401: 'cf_mc_prod_lyrformula': Fatal PL/SQL error occurred.
    ORA-01839: date not valid for month specified
    Report Builder: Release 6.0.8.24.0 - Production on Wed Sep 4 11:37:20 2013
    (c) Copyright 1999 Oracle Corporation.  All rights reserved.
    Enter Username:
    +---------------------------------------------------------------------------+
    Start of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    +---------------------------------------------------------------------------+
    End of log messages from FND_FILE
    +---------------------------------------------------------------------------+
    Program exited with status 1
    Concurrent Manager encountered an error while running Oracle*Report for your concurrent request 11426643.
    Review your concurrent request log and/or report output file for more detailed information.
    +---------------------------------------------------------------------------+
    Executing request completion options...
    Finished executing request completion options.
    +---------------------------------------------------------------------------+
    Concurrent request completed
    Current system time is 04-SEP-2013 11:59:23
    +---------------------------------------------------------------------------+
    kindly give me solution .....i have e-business suite 11i
    internet explorer latest version...

    Hi,
    Please confirm whether this is a custom or standard report.
    If this is a custom report, then probably the respective issue has not been handled by exception handling.
    Also please refer note:
    How to check if version 11.5.10.2 is certified to Handle Leap Years (Doc ID 549937.1)
    Thanks &
    Best Regards,

  • How to do a date validation with leap years

    I'm doing a date validation program in my Java class, and well it's pretty hard (for me that is). I have to be able to type in a date, have it say whether it's a leap year or not, and print out the number of days in the month. It seems pretty straight forward, but I get confused on trying to do the 'if else' statements and even the simplest things like getting the day prompting to work. >< The years I'm doing only goes through 1000 to 1999, so that's why those numbers are there. The program isn't complete, so if anyone could help show me what I'm doing wrong in the areas I'm working on then I'd appreciate it...and I'm still kind of in the basics of Java so if you do hint me with some code then I'd appreciate it if it was stuff that's not too advanced so yea.
    // Dates.java
    // Determine whether a 2nd-millenium date entered by the user
    // is valid
    import java.util.Scanner;
    public class Dates
    public static void main(String[] args)
    int month, day, year; //date read in from user
    int daysInMonth; //number of days in month read in
    boolean monthValid, yearValid, dayValid; //true if input from user is valid
    boolean leapYear; //true if user's year is a leap year
    Scanner scan = new Scanner(System.in);
    //Get integer month, day, and year from user
    System.out.print("Type in the month: " );
              month = scan.nextInt();
    System.out.print("Type in the day: " );
              day = scan.nextInt();
    System.out.print("Type in the year: " );
              year = scan.nextInt();
    //Check to see if month is valid
    if (month >= 1)
    month = month;
    else
    if (month <= 12)
    month = month;
    else;
    //Check to see if year is valid
    if (year >= 1000)
    year = year;
    else
    if (year <= 1999)
    year = year;
    else;
    //Determine whether it's a leap year
    //Determine number of days in month
    if (year == 1 || 3 || 5 || 7 || 8 || 10 || 12)
         System.out.println (Number of days in month is 31);
         else (year == 4 || 6 || 9 || 11)
         System.out.println (Number of days in month is 30);
    //User number of days in month to check to see if day is valid
    //Determine whether date is valid and print appropriate message
    // Dates.java
    // Determine whether a 2nd-millenium date entered by the user
    // is valid
    import java.util.Scanner;
    public class Dates
    public static void main(String[] args)
    int month, day, year; //date read in from user
    int daysInMonth; //number of days in month read in
    boolean monthValid, yearValid, dayValid; //true if input from user is valid
    boolean leapYear; //true if user's year is a leap year
    Scanner scan = new Scanner(System.in);
    //Get integer month, day, and year from user
    System.out.print("Type in the month: " );
              month = scan.nextInt();
    System.out.print("Type in the day: " );
              day = scan.nextInt();
    System.out.print("Type in the year: " );
              year = scan.nextInt();
    //Check to see if month is valid
    if (month >= 1)
    month = month;
    else
    if (month <= 12)
    month = month;
    else;
    //Check to see if year is valid
    if (year >= 1000)
    year = year;
    else
    if (year <= 1999)
    year = year;
    else;
    //Determine whether it's a leap year
    //Determine number of days in month
    if (year == 1 || 3 || 5 || 7 || 8 || 10 || 12)
         System.out.println (Number of days in month is 31);
         else (year == 4 || 6 || 9 || 11)
         System.out.println (Number of days in month is 30);
    //User number of days in month to check to see if day is valid
    //Determine whether date is valid and print appropriate message
    }

    Here are some helpfull hints for you:
    1. Your code is really hard to read, there are two main reasons for this. First, your indentation sucks. Second, you seem to be fascinated with saving two (ok four if you count the shift key) keypresses to avoid using { and }.
    2. Not using the brackets (you know { and } which you like to avoid) also is causing your code to do some stuff you don't realize or want to happen, or at least it would be if your code compiled.
    3. If statements require arguements, "year == 1" is an arguement, "3" is not an arguement. Each operator like the or operator ("||") is essentially a new if and requires a complete arguement. So the following code peice:
    if (year == 1 || 3 || 5 || 7 || 8 || 10 || 12)Literally translates to if year equals 1 or if 3 or if 5 or if 7 or if 8 or if 10 or if 12. Doesn't make much sense in english, and it doesn't make much sense in Java either.
    4. I am pretty sure "year" is not the variable you want in the code snippet above (the one used in hint 3), especially considering years 1, 3, 5, 7, 8, 10, and 12 are not between 1000 and 1999. You need to be really carefull not make these kind of mistakes when coding, because they are by far the hardest to track down and fix later since they don't really throw up any flags or anything at compile or run time. Take your time and think thuroughly about each line of code while coding it, it will save you tons of time in the long run.
    5. What exactly do you expect statements like "month = month;" to do? That translates as make month equal to month. Do you go to the bank and say " I have exactly $3.56 in my pocket, so I would like to deposite all $3.56 and then withdraw $3.56 and put it back in my pocket"? How do you think the teller would look at you? Teller would probably do it, but the teller would feel like he/she wasted time with you and that you are not really right in the head. Java feels the same way when you make it do the same thing, and you love to do it.
    6. Code like the following is all wrong, and for more reasons than pointed out in hint 5.
    if (month >= 1)
    month = month;
    else
    if (month <= 12)
    month = month;
    else;Let's say someone put 13 in as the month. It passes the first check because 13 is greater than or equal to 1. so month which is 13, now gets set to 13 (gee that was effective). Now we hit the else and things get confusing because you didn't use brackets or proper indentation (hint 1) so we don't know what your real intent was. Did you mean else do nothing, and the next if statement is then executed, or did you mean to just run the next if statement if the else condition was met? Fortunatly it doesn't matter here because the next if statement is failed anyways since 13 is not less than or equal to 12.
    So, we leave this code with month ebing 13, wait when did we add a 13th month to the calendar? Are you using the Jewish calendar? Could be, except even if I put 1234567 as the month your code would except it as valid, and I know no calendar with that many months. Try writing this in english first and translating it to jave, like i would probably say "if the month is greater than or equal to 1 and less than or equal to 12 then the month is valid." Course now what do you do if it is invalid? Hmm, maybe I would actually say "while the month is less than 1 or greater than 12 ask the user for the month" until they get it right.
    There are a few other problems, but most of them are probably things you haven't learned yet, and they are not show stoppers so we will let them fly. You already have a lot of work to do to make this better. But I do have one more really really big usefull hint for you:
    Never, ever, under any circumstances, should you ever ask in any way or even hint at asking for someone else to provide code solutions to your problems. So "so if you do hint me with some code then I'd appreciate it if it was stuff that's not too advanced " was a very bad thing to do, but fortunatly for you you followed it with proof you were trying to write the code yourself. Had the code you provided not been so full of problems it was obvious a beginner wrote it, you would probably have gotten much less cordial responses. I would seriously consider avoiding any implication of wanting code, at least until you become a regular poster here and people know you are not just looking to get your homework done for you.
    Hope some of this helps.
    JSG

  • Leap year without date objects

    I need to check to see how many leap years are between two user-inputted years and I can't use date objects. I figure I need to start with a for loop, but I get lost when to by the mod 4, mod 100, or mod 400. Any help?
    for(int l=cYear; l <= eYear; l++){
                        if(l%4 == 0){
                             if(l%100 == 0){
                   }also, if anyone is bored and really wants to give of themselves, I could use some more help with a pretty challenging-for-my-level program. Let me know.
    Message was edited by:
    kaluga

    yeah, he said like 20 times "one big main method, no
    other methods"He's a moron and should not be teaching CS or Java.
    Problems: 1. I am having trouble wrapping my mind
    around the logic,Meaning what? You described it--or was that just copy/paste of what's in the asisgnent? I gave you some pseudocode that's practically Java already.
    Just try it. Take your best shot and write some test cases and see how close you are.
    2. I don't know if this (below)
    syntax works.Try it. If the syntax is wrong, it won't compile.
    Once you get it to compile, then test it. Here's one reason why you'd want a separate method--you could test just that method by itself. As it stands, the easiest way to test it is to always give it just one year and see if you end up with the proper count--zero or one. If you give it many, you could end up with the right number by having the same number of false positives and false negatives.
    Once you know it works for one year, feed it a few lists of 5 or 10.
    btw jverd, I appreciate your helpYou're quite welcome. It looks like you're on the right track. Just don't be afraid to try stuff and see what happens, and then come back with specific questions about the specific problems you observed. :-)
    ---- Edit ----Or do like DrClap suggested and print each one. This way you can still test many at once.
    Note to self: Duh, Jeff.
    ---- ---- ----Message was edited by:
    jverd

  • Leap Year - Control Record UK

    Hello everybody,
    I have a strange think in my control record for UK for February:
    We are in a Leap Year so February end on a 29th, but in the control record it's show 28th ?
    Is it a bug that need to be declare in OSS ?
    THanks a lot
    KR
    Greg

    YOu haave to check the period definitions in T549Q, maybe it is incorrectly defined there.

  • Leap Year, Month, determination program

    Hi - it's the learning student again :) Our new assignment is to create a program to determine leap year, month and day information. So basically you enter a year and the program says if it is a leap year. Then you enter a month and the program determines if that month is part of that leap year. And then you enter a day and determine if that day is part of that leap month that is part of that leap year. I have written a program to determine if it is a leap year and to determine that if the month is february it is a leap month, but not if the month is part of that leap year - so I am missing a step. And so it goes for the leap day - I have created the program to read that the 29th is a leap day but not exculsively to the month of february that falls in the leap year. Make sense? Here is my code so far:
    Here are details of the assignment:
    1.Prompt the user for a year using GUI dialogue window.
    a.Remember to give the user clear direction on input requirements.
    i.E.g. "Please enter month as integer 1-12:"
    2.Prompt the user for the month using GUI dialogue window.
    a.Remember to give the user clear direction on input requirements.
    b.** Please note: month must be input as a string, and then converted to an integer for the case statement below. This may require 2 case statements.
    3.Prompt the user for a day in the month.
    a.This must return a message to the user if the month doesn’t include that day.
    b.i.e. entering 30 in a February month should tell the user it is an invalid day and stop execution.
    4.Check to see if the year is a leap year.
    5.Check to see if the month is a leap month.
    6.Check to see if the day is a leap day.
    7.Display a user friendly back to the consumer indicating:
    a.Year entered & If it is a leap year
    b.Month entered & if it is a leap month.
    c.The number of days in the month (e.g. January has 31 days, whereas February has 28 unless it is a leap year.
    d.The day of the month entered & whether or not is a Leap day.
    e.Output can be in three different dialogue windows, or just 1 if desired.
    And here is my code - I am not sure what to do next. It is running and compiling without any errors right now but I know I am missing some steps. Any help or advice in what steps to take next would be appreciated!
    import javax.swing.JOptionPane;
    public class Leap_Year {
         public static void main (String[] args) {
         //Enter a year
         String enterYearString = JOptionPane.showInputDialog("Enter a year: ");
         //Convert year to an integer
         int enterYear = Integer.parseInt(enterYearString);
         // Check if year is a leap year
              boolean isLeapYear =
                        (enterYear % 4 == 0 && enterYear % 100 != 0) || (enterYear % 400 == 0);
         //Enter a month
              String enterMonthString = JOptionPane.showInputDialog("Enter a month as an integer, e.g. 1-12: ");
         //Convert month to an integer
         int enterMonth = Integer.parseInt(enterMonthString);     
         //Check if month is a leap year
                   boolean isLeapMonth =
                             (enterMonth == 2);
         //Enter a day
                   String enterDayString = JOptionPane.showInputDialog("Enter a Day as an integer, e.g. 1-31: ");
         //Convert day to an integer
              int enterDay = Integer.parseInt(enterDayString);     
         //Check if day is a leap day
                        boolean isLeapDay =
                                  (enterDay == 29);          
         //Display the result
         String output = "The year " + enterYear + " is a leap year is: " + isLeapYear +
                   "\nThe month " + enterMonth + " is a leap month is: " + isLeapMonth +
                   "\nThe day " + enterDay + " is a leap day is: " + isLeapDay;
         JOptionPane.showMessageDialog(null,output);
    }

    Ok - so I may have "over-coded" - since I am totally new to programming this might be sloppy. Apologies ahead of time. I have most of the stuff figured out. A couple of problems I am having. When I display my results as to whether or not the month is a leapy year is reads as:
    The year 2012 is a leap year is: true
    The month of February in the year 2012 is a leap month is: true
    How would I go about making it display something simple like:
    The year 2012 is a leap year.
    The month of February in the year 2012 is a leap year. OR
    The year 2013 is not a leap year.
    The month of January in the year 2013 is not a leap month.
    Additionally, I need to write a case statement that would return an error statement if someone tried to enter the wrong number of days in a month (example entering 31 days for the month of February).
    Here is my current code:
    import javax.swing.JOptionPane;
    public class LeapYear2 {
         public static void main (String[] args) {
         //Enter a year
         String enterYearString = JOptionPane.showInputDialog("Enter a year: ");
         //Convert year to an integer
         int enterYear = Integer.parseInt(enterYearString);
         // Check if year is a leap year
              boolean isLeapYear =
                        (enterYear % 4 == 0 && enterYear % 100 != 0) || (enterYear % 400 == 0);
         //Enter a month
              String enterMonthString = JOptionPane.showInputDialog("Enter a month as an integer, e.g. 1-12: ");
         //Convert month to an integer
         int enterMonth = Integer.parseInt(enterMonthString);     
         //Check if month is a leap year
                   boolean isLeapMonth =
                             (enterMonth == 2 && enterYear % 4 == 0 && enterYear % 100 != 0) || (enterYear % 400 == 0);          
         //Enter a day
                   String enterDayString = JOptionPane.showInputDialog("Enter a Day as an integer, e.g. 1-31: ");
         //Convert day to an integer
              int enterDay = Integer.parseInt(enterDayString);     
         //Check if day is a leap day
                        boolean isLeapDay =
                                  (enterDay == 29 && enterMonth == 2 && enterYear % 4 == 0 && enterYear % 100 != 0) || (enterYear % 400 == 0);          
         //Set number of days to a variable
                        int numDays;
         //Calculate the number of days in a month                    
                        if (enterMonth == 2)
                             if (isLeapMonth)
                             numDays=29;
                        else
                             numDays = 28;
                        else if (enterMonth == 1 || enterMonth == 3 || enterMonth == 5 || enterMonth == 7 || enterMonth == 8 || enterMonth == 10 || enterMonth == 12)
                             numDays = 31;
                             else
                                  numDays = 30;
         //Set the name of the month to a variable
                        String month = null;
         //Determine the number association to the name of the month
                        if (enterMonth == 1)
                             month = "January";
                        if (enterMonth == 2)
                             month = "February";
                        if (enterMonth == 3)
                             month = "March";
                        if (enterMonth == 4)
                             month = "April";
                        if (enterMonth == 5)
                             month = "May";
                        if (enterMonth == 6)
                             month = "June";
                        if (enterMonth == 7)
                             month = "July";
                        if (enterMonth == 8)
                             month = "August";
                        if (enterMonth == 9)
                             month = "September";
                        if (enterMonth == 10)
                             month = "October";
                        if (enterMonth == 11)
                             month = "November";
                        if (enterMonth == 12)
                             month = "December";
         //Display the result
         String output = "The year " + enterYear + " is a leap year is: " + isLeapYear + "." +
                   "\nThe month of " + month + " in the year " + enterYear + " is a leap month is: " + isLeapMonth + "." +
                   "\nThe day " + enterDay + " is a leap day is: " + isLeapDay + "." +
                   "\nThe month of " + month + " in the year " + enterYear +" has " + numDays +" days in it.";
         JOptionPane.showMessageDialog(null,output);
    }

  • IS-U billing in a leap year

    Dear experts,
    We try to bill, in SAP IS-U, a period, begins in a non-leap year and ends in a leap year, (eg 01.11.2011 to 16.02.2012), with an annual price.
    We have implemented BADI ISU_BI_SIM_PRICE in order to cut the billing period into two periods, for rates based on annual calculation only (Z_FIX).
    We found that the calculation of basic monthly price facturation is also cut (e.g the rate :Z_QTE_IND)
    Please find attached the badi implementation and a copy of schemas.
    Best regards

    See my first guess below:
    1. In Invoice execution, error 'record 9000121411 not found in table EVER'?
    I think that the data you are trying to bill does not have a an active contract in the bill period you are billing for (unless you are creating a FINAL bill). This may be something you may have verified already, but I would suggest just in case go and check EVER table for the contract you are billing for is an active contract?
    2.Billing error: Operand factor error
    The OPERAND value is missing in the billing period. It has to be available in either Installation facts, RCfacts or rate facts for billing to pass on the operand value for further calculations.
    3. Manual billing is not reflecting the new IS_U contract (stoill showing old contract) ?
    Can you clarify on this one? When you said manual bill - Is it created through EA16? If it is created through EA16, then you have a choice of entering the correct contract in it on the screen itself.
    Hope this helps in your investigation.
    -Q

  • Finding a function to get leap year

    Hi everybody!
    I need a function or code to find  if a year is  leap year or normal year.
    Thanks a lot of!
    DM

    Here is some code that I had in my bag of tricks.
    report zrich_0001 .
    parameters: p_datum type  sy-datum.
    * check if it is a leap year.
    data: march1 type sy-datum.
    data: last_day_feb type sy-datum.
    march1 = p_datum.
    march1+4(4) = '0301'.
    last_day_feb = march1 - 1.
    if last_day_feb+6(2) = '29'.
    write:/ 'This is a leap year'.
    endif.
    Regards,
    Rich Heilman

  • When I tried to import fro my camera, I cant get the last day to import. Could  it have anything to do with Feb 29,2011 being Leap Year?

    When I tried to import  from my camera, the last day did not import, I keep retrying, but will not import. Could it have anything to do with the date Feb 29, 2012 as it was Leap Year?

    OK Texas, so nothing strange with the calendar (unless you folk have seceded since the last time I checked the news )
    Image Capture is an Apple App that comes with the OS. Allows you to do a bunch of things. Import pictures from your camera is one. Open the app with your camera connected. If you have Aperture set to open when the camera is connected just close Aperture and then open Image Capture.
    You'll see the camera and it should show you the images on the camera card. See if the images from the 29th show up.
    post the results.
    regards

  • Validating Leap Years

    Is there a way of checking that an entered leap year date is valid?
    Eg. User enters 2/29/2001 which is not a valid date because 2001 was not a leap year.

    You should be able to use the SimpleDateFormat class to do this by issuing a setLenient(false) call. However, it does not seem to detect a leap year problem with the date 2/29. If you run the code below, you'll see that in the first section it correctly detects that 2/30 is a bad date, but in the second section, it does not detect 2/29 as a bad date. In section 3, you can see how an added test can detect the problem date.
            //Date validation
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            //Section 1 - correctly detects bad date
            try {
                String date = "2001-02-30";
                System.out.println("Here's the date - " + sdf.parse(date));
                sdf.setLenient(false);
                System.out.println("Here's the date - " + sdf.parse(date));
            } catch (ParseException pe) {
                System.out.println("Bad date");
            //Section 2 - does not detect bad date
            try {
                String date = "2001-02-29";
                System.out.println("Here's the date - " + sdf.parse(date));
                sdf.setLenient(false);
                System.out.println("Here's the date - " + sdf.parse(date));
            } catch (ParseException pe) {
                System.out.println("Bad date");
            //Section 3 - correctly detects bad date with additional check
            try {
                String date = "2001-02-29";
                System.out.println("Here's the date - " + sdf.parse(date));
                sdf.setLenient(false);
                //Additional test to compensate for leap year failure
                String dateString = sdf.format(sdf.parse(date));
                if (!dateString.equals(date)) {
                    System.out.println("Bad date");
                } else {
                    System.out.println("Here's the date - " + sdf.parse(date));
            } catch (ParseException pe) {
                System.out.println("Bad date");
            }

  • Reg : Leap Year

    Hi All,
      Is there any function module to find, whether the
      given year is a Leap year or not? Please tell me.
      Thanks in advance.
    Thanks&Regards,
    Siri.

    hi srilatha
    I'm not sure if sap delivers such a function module but writing one yourself should be quite easy.
    Posibility one: implement the correct algorithm
    leap years are years which can be divided by 4 (e.g. 2004) but are no centuries (e.g. 1900). But years which can be devided by 400 are leap years although they are centuries (e.g. 2000 was a leap year).
    Posibility two: try the following (bases on the fact that sap can calculates the leap years correct in the date datatype)
    - define a function module
    - importing parameter iv_year (NUMC 4)
    - exporting parameter ef_leap_year (CHAR 1)
    - coding
    data:
    lv_date like sy-datum value '00000228'.
    lv_date(4) = iv_year. " set the year to the date
    ADD 1 TO lv_date. " calculate the next day
    IF lv_date+4(4) EQ '0229'. " get the MMDD part of date
    ef_leap_year = 'X'. " yes it is a leap year
    ELSE.
    ef_leap_year = ''. " no it is not a leap year
    ENDIF.
    or check this one
    FM DATE_CHECK_PLAUSIBILITY will check if a date is valid. You can either use this FM to check 28.02.xxxx for a given year, or copy the piece of coding which checks for a leap year.
    You can use FM NUMBER_OF_DAYS_PER_MONTH_GET by passing '02' as month and YEAR.
    Regards,
    naveen

  • How to find leap year in sql query

    How to find leap year in sql query

    Select
    CASE
      WHEN result = 0 THEN 'Leap_Year'
      WHEN result <> 0 THEN 'Not_A_Leap_Year'
    END
    From (Select mod((EXTRACT(YEAR FROM DATE '2013-08-24')), 4) result FROM DUAL);

Maybe you are looking for

  • Keeping my macbook awake with an external monitor

    So, I just hooked up my 15" macbook pro to my Samsung LCD using the mini display/port to HDMI adapter which in and of itself has resulted in some resolution problems, although that's something for another day. My big issue currently is that I'd like

  • Line number does not match in opteron assembly

    Hi, I have made an assembly for one of my files on Opteron but the problem i face is the line numbers shown by it does not match my code. I am getting a core in the same file and i am able to find the function name but the line numbers and offsets ar

  • Invalid code in the column and DUMP function

    Hi all, My DB is 11.1 and Character set is UTF8. After ETL, I find some invalid characters appear in my tables, one of which is '�'. Since they are history data, I can't find the source data for them. The only choice for me now seems to remove all of

  • Need help - setup network in solaris

    Hello! Today I install Solaris 10 for learning in my laptop and have some trouble. Please help me 1. Set up network interface for wi-fi card iwi0 (a. ifconfig iwi0 plumb b. wificonfig iwi0 connect airJet c. ifconfig iwi0 dhcp) 2. Set up default route

  • Selectively deactivate hierachies in worksheet

    i have a worksheet that reports Sales Amt by Products. The Product Name will appear as rows. The product name field comes from a dimension with fields like Product ID, Product Name, Brand. Because i have a hierarchy by Brand by Product, i will automa