Date Calculations - Adding 1 to the day and adjusting month/year

Hi all,
I have a date field in MM/ DD/ YYYY format. If I add 1 to the DD (day) field, and I hit the end
of the month/year I need to adjust the MM and YYYY accordingly.
Is there is an existing class/method in the JAVA API that would handle somthing like this??
If so , I can't find it..... I don't want to re-invent the wheel creating a Date Handling routine just
for this program.......
Thanks very much

This is overkill... (and sorry that this post is over a year later than the original post... hopefully somebody will benefit from it :)
Calendar.getInstance() by default instanciates a GregorianCalendar
object. (check the src).
Therefore:
Calendar cal = Calendar.getInstance();
cal.setTime(d); // where d = java.util.Date or java.sql.Timestamp
cal.add(Calendar.DATE, numberOfDays);
return cal.getTime();
public static java.util.Date
adjustDateBy(java.util.Date d, int numberOfDays) {
java.util.GregorianCalendar cal = new
java.util.GregorianCalendar();
     cal.setTime(d);
cal.add(java.util.GregorianCalendar.DATE,
numberOfDays);
     return cal.getTime();

Similar Messages

  • Can I get the date to display along with the day and time

    can I get the date displayed with the day of week and time?

    Hi Mary, you can, but what version of OSX are you running on what Mac?
    See if this helps for starters...
    http://paulstamatiou.com/how-to-display-date-in-os-x-menu-bar

  • How can I add the date at the top of the screen along with the day and time display?

    Hello,
    How can I add the date at the top of the screen along with the day and time display?
    Thanks so much!

    Open System Preferences>Date & Time:
    Ciao.

  • Position of the days and dates being on the right side of the day in the week calendar.

    I'm having a huge problem with the days and dates being on the right side of the day in the week calendar. Can I change that to the left upper side?
    it makes the whole schedule off balance you see.

    Thanks for stating that. So quickly. That *****. I also now see that more people have problems with this. Where can I complain?

  • HT201299 Is there an App which switches on Cellular data at a Particular time of day and switches off as well? if not someone should make an app

    Is there an App which switches on Cellular data at a Particular time of day and switches off as well? if not someone should make an app for that

    No, there are no apps that can do that, as no app would have access to the necessary API's to perform such a task.

  • How to calculate the number of days until your next birthday. Only using current month, day and birth month and day.

    I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
    Attachments:
    D5.7_1.vi ‏8 KB

    I just had a little fun with the Time Record...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    D5.7_1_BD.png ‏19 KB

  • How do I get the iTunes festival to play on my Apple TV in the evening, as I work during the day and can't watch it at 4:00pm?  I have the app installed on my iPad and can't get it to play!

    How do I get the iTunes festival to play on my Apple TV in the evening, as I work during the day and can't watch it at 4:00pm?  I have the app installed on my iPad and can't get it to play!

    I haven't received an answer. I hope someone can answer this because it's an ongoing problem that I can't play some CDs on my MacBook Air (see my original post for the details). Anyone? Please? Thanks in advance!

  • How to change the day and time seen on the calendar

    Hi.
    I am a bit confused as to how to restrict the day and time shown on a calendar.
    The ical help says this:
    To change the days of the week or the number of hours that appear in the main calendar view, choose iCal > Preferences, and make your choices from the Week and Day pop-up menus in the General pane. For example, you can choose to only see the hours from 9AM to 5PM on Monday through Friday.
    However, in my preferences pane, i don't have a either a week or day pop up menu that i can see, so i can't seem to restrict these fields. It's really frustrating as calendars are beginning at 1am!!!!
    Anybody got any ideas?
    Thanks
    David Tobin

    OK, but what did the help menu mean when it said..
    To view the day's, week's, or month's events, click the Day, Week, or Month button at the bottom of the iCal window.
    To change the days of the week or the number of hours that appear in the main calendar view, choose iCal > Preferences, and make your choices from the Week and Day pop-up menus in the General pane. For example, you can choose to only see the hours from 9AM to 5PM on Monday through Friday.
    To change which months are shown in the mini-month calendar (in the lower-left corner of the iCal window), click the arrows above the mini-month calendar. To see more than one month, drag the mini-month divider (the horizontal gray bar above the diamond) upward.
    To see events that are earlier or later in the day, use the scroll bar on the right side of the main calendar view.
    To change the range of time in the main calendar view that is not shaded (representing your "normal" day), choose iCal > Preferences. In the General pane, choose the times you want to appear in white (not shaded) from the "Day starts at" and "Day ends at" pop-up menus. All times outside that range are shaded.
    This suggests that you should be able to limit the hours actually shown on the calendar to a set range as opposed to just changing the shaded area.
    Have you any idea how to achieve this, as i don't see the popup menu suggested with...
    To change the days of the week or the number of hours that appear in the main calendar view, choose iCal > Preferences, and make your choices from the Week and Day pop-up menus in the General pane. For example, you can choose to only see the hours from 9AM to 5PM on Monday through Friday.
    I am confused!!
    Any other ideas?
    David Tobin

  • Spotlight and finder cannot find files as of a certain date. What can be the problem and how to solve?

    Spotlight and search field in Outlook on MacBoon cannot find files as of a certain date. What can be the problem and how to solve?

    Reinstall on both.
    Reinstall Lion, Mountain Lion, or Mavericks without erasing drive
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported then click on the Repair Permissions button. When the process is completed, then quit DU and return to the main menu.
    Reinstall Mountain Lion or Mavericks
    OS X Mavericks- Reinstall OS X
    OS X Mountain Lion- Reinstall OS X
    OS X Lion- Reinstall Mac OS X
         Note: You will need an active Internet connection. I suggest using Ethernet
                     if possible because it isthree times faster than wireless.
    Restore your iPhone to reinstall iOS. Be sure to do this while connected to your computer and iTunes.
         Tap Settings > General > Reset > Erase all content and settings.

  • HT4623 I tried to download the app of the day and I was told I was in the US store and that I needed to go the the Canada store. This is the first time I have encountered this. As far as I know I set up my account with the US store. Any advice? Thanks

    I tried to download the " app of the day " and was told that I was in the US store and that I needed to go to the Canada store. I never encountered this before .
    As far as I know I registered in the US store. Does anyone have any advice.
    thank you

    See "Change your iTunes Store country" > http://support.apple.com/kb/HT1311

  • Adding product cleared the topic and title !!!!

    adding product cleared the topic and title !!!!
    not good i had a big paragraph.

    anyone have any idea about this, it's very frustrating

  • HT4157 I have a cellular data account on my iPad. Almost immediately after I signed up, my e-mail was hacked and had to be cancelled. I cannot get into my AT&T cellular data account now to change the billing and account to my new e-mail. Please help.

    I have a cellular data account on my iPad. Almost immediately after I signed up, my e-mail was hacked and had to be cancelled. I cannot get into my AT&T cellular data account now to change the billing and account to my new e-mail. Please help.

    According to the AT&T Wireless web site, you can manage your iPad data plan either from the iPad, or by using a web browser:
    From the website
    Log in to your account at att.com/iPadlanding using the email address and password you used during activation.
    Your account information will display. Select the desired account change option then tap Next.
    Read the Terms of Service, and then tap Accept.
    Review the Payment Summary to ensure the details are correct. Use the Back button if changes are required, otherwise tap Submit.
    Read the Confirmation message then tap OK.

  • My phone goes off in any time of the day and the only way to get it back is through pressing and holding of Home and Sleep button together

    Like I said in the subject line:
    My brand new iPhone 4S/32Gb goes off in any time of the day and the only way to get it back to live is through pressing and holding of the Home and Sleep button together for 5-10 seconds.
    Does anybody have that kind of problem as well?
    Thank you.

    I restored it on I tunes as well did something on the phone. The lastest seems to have helped it but I haven't used it much yet!  Thanks for the help & I'll let you know!

  • HT2513 I can barely see the day and time numbers in ical - any suggestions?

    I can barely see the day and time numbers in ical. I have tried adjusting contrast but doesn't help. Any suggestions?

    Could be corrupt plist try deleting com.apple.systemuiserver.plist
    found here  by using Finder>Go>Go to Folder (command shift G):
    copy and paste:
    ~/Library/Preferences/ com.apple.systemuiserver.plist
    delete this plist.
    now open terminal (Applications/Utilities/terminal.app) and paste the command:
    killall SystemUIServer
    and return. This command will kill the process and MacOS X will automatically rebuild the menu bar, clearing out old cache. Quit Terminal.
    Restart if neccessary.

  • Report for current day and current month

    Hi gurus,
    i 've a report, where i 've to display the values for qty and cost of the material for the current day and current month
    HOw can i do this in BEx Query designer..If any document plz share
    thanks
    rakesh

    hi Kolli
    here i want to filter the data on system date,
    i wnt the report to pick the date dynamically based on the system date.
    but i think restricting on calmonth and calday is not going to solve my scenario..
    rakesh

Maybe you are looking for

  • How to get the date n time for log in ODI

    Hi, I wanna ask, what is the syntax for getting the date n time when i specify the location of log for Interface. Thanks.

  • Automatically start iTunes when iPhone is connected

    How do I change the setting on my iphone 4 to tell itunes to automatically start when the phone is connected? The option is greyed out.

  • Missing element To when using SOAP 1.2 with WS Addressing 1.0 in Response

    Hi,  I'm developing WCF using  SOAP 1.2 with WS Addressing 1.0 between Windows Server 2012 and JAVA client Oracle JAX-WS 2.1.5. The Request from the client contains the element <To>, but the Response from the Server somehow will ignore that element,

  • Rfc XML Purchase Order via business connector

    Hi, I am new to business connector and currently I am faced with a task where I have to send the Purchase Order to vendor via rfc XML with business connector 4.7. The vendor should receive the order via ebp XML. Can any one specify me the exact steps

  • Turning off geotagging in Palm Centro

    My daughter is using my old Palm Centro.  She takes lots of pics and uploads them online.  I want to turn geotagging off.  Not even sure if this is something the Centro does...can't find any info about it.  Can anyone help?? Post relates to: Centro (