Using the Calendar Object

I have code as follows
String strBeginDate =  '12-02-2014'
formatter = new SimpleDateFormat("mm-dd-yyyy"); 
Date dtBeginDate = (Date) formatter.parse(strBeginDate);
Calendar cal = Calendar.getInstance();   
cal.setTime(dtBeginDate);
System.out.println("Calendar's Year: " + cal.get(Calendar.YEAR));
System.out.println("Calendar's Month: " + cal.get(Calendar.MONTH));
System.out.println("Calendar's Day: " + cal.get(Calendar.DATE));
Result:
Calendar's Year: 2014
Calendar's Month: 0
Calendar's Day: 2
Why is the month shown as '0' instead of '12' ? What should be done to retain the value of 12?

Hi
the problem is with the parsing. Try this : new SimpleDateFormat("MM-dd-yyyy"); The Big M is per definition the Month of the year.
Nevertheless you will get 11 and not 12 because the first month, January is 0 and not 1
public static final int MONTH
Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year in the Gregorian and Julian calendars is JANUARY which is 0; the last depends on the number of months in a year.
best regards, Nicolas

Similar Messages

  • Is anyone using the Calendar Server to send external invites?

    Is anyone using the Calendar Server to send external invites?
    We have a Mountain Lion server running DNS, Open Directory, File Sharing and VPN. We have recently stood up the Calendar server and it is working very well. Internal invites work fine and are instantaneous to computer, iPhone, iPad. We have the ports working so that calendar items created outside the network work fine as well. Only problem is we cannot invite anyone with an external e-mail address. Each time we do the Calendar Error Log populates with:
    2013-04-15 13:11:03-0500 [-] [mailgateway] 2013-04-15 13:11:03-0500 [Uninitialized] SMTP Client retrying server. Retry: 5 
    2013-04-15 13:11:03-0500 [-] [mailgateway] 2013-04-15 13:11:03-0500 [Uninitialized] SMTP Client retrying server. Retry: 4
    2013-04-15 13:11:03-0500 [-] [mailgateway] 2013-04-15 13:11:03-0500 [Uninitialized] SMTP Client retrying server. Retry: 3
    2013-04-15 13:11:03-0500 [-] [mailgateway] 2013-04-15 13:11:03-0500 [Uninitialized] SMTP Client retrying server. Retry: 2
    2013-04-15 13:11:03-0500 [-] [mailgateway] 2013-04-15 13:11:03-0500 [Uninitialized] SMTP Client retrying server. Retry: 1
    2013-04-15 13:11:03-0500 [-] [mailgateway] 2013-04-15 13:11:03-0500 [Uninitialized] [twistedcaldav.mail.MailHandler#error] Mail gateway failed to send message <[email protected]> from [email protected] to mailto:[email protected] (Reason: Failure with multiple causes.)
    We have set up an internal e-mail address. I have confined that it works fine. I have tried more than one internal account. I have also verified the settings through the command line by typing "sudo serveradmin settings calendar" The iMIP sending and receiving information is correct. There is no authentication type setting listed in the command line output even though there's a place to choose it in the Enable invitations by email - Edit button on the third screen. No matter what I choose it goes back to "login" and still doesn't work.
    The command line settings mention a port number 62310 as being the MailGatewayPort but opening that port on the network's firewall makes no difference. As I said external set up works fine from Mac/iPhone/iPad and push notification works fine as well.
    Is anyone using this functionality?

    I'm sorry. I forgot to add Mail to the list of services. I AM using mail on that server. Here's the iMIP portion of my settings output from Terminal.
    calendar:Scheduling:iMIP:Sending:Server = "boardwalkserver.kuhnwitt.com"
    calendar:Scheduling:iMIP:Sending:UseSSL = yes
    calendar:Scheduling:iMIP:Sending:Username = "calendarserver"
    calendar:Scheduling:iMIP:Sending:Address = "[email protected]"
    calendar:Scheduling:iMIP:Sending:Password = "password"
    calendar:Scheduling:iMIP:Sending:Port = 465
    calendar:Scheduling:iMIP:Enabled = yes
    calendar:Scheduling:iMIP:MailGatewayPort = 62310
    calendar:Scheduling:iMIP:Receiving:Server = "boardwalkserver.kuhnwitt.com"
    calendar:Scheduling:iMIP:Receiving:UseSSL = yes
    calendar:Scheduling:iMIP:Receiving:Username = "calendarserver"
    calendar:Scheduling:iMIP:Receiving:PollingSeconds = 30
    calendar:Scheduling:iMIP:Receiving:Type = "imap"
    calendar:Scheduling:iMIP:Receiving:Password = "password"
    calendar:Scheduling:iMIP:Receiving:Port = 993
    calendar:Scheduling:iMIP:AddressPatterns:_array_index:0 = "mailto:.*"
    calendar:Scheduling:iMIP:MailGatewayServer = "localhost"
    So Add mail to the services being used. Since Calendar is running on the mail server one would assume that it could communicate with it fairly easily.

  • How to use the ViewRowImpl objects in JSP?

    Is there anyway for me to use the ViewRowImpl objects in the JSP (so I could call the set<attribute> methods and get<attribute> methods to retrieve the attributes? Right now I am retrieving all the information I need in the application tier from the database, marshal them myself, and then return the marshaled data back to the JSP side in the presentation tier, then demarshal the data, and finally interpret the demarshaled data. I did this because I want to return everything in one single remote method call, and I know this is really ugly, but I do not know of any other way for me to retrieve all information needed by a JSP page in one single method call. Any suggestions?

    I've done this in servlets.
    I created an application module (with an ic.lookup() call, see the documentation) and then used the appModule to create my view.
    Once you've got that you can iterate through rows and use the accessor methods.
    You might need a wrapper method to get the ViewObjectImpl in your jsp...

  • How to use the calendar in beehiveonline?

    The docs suggest that you can use the calendar to schedule meetings.
    Assuming that I am using Outlook (connected to our internal beehive), and a customer is using Outlook connected to their email server.
    What steps are required to allow both of us to see each others availability and schedule a meeting?
    Thanks,
    Michael

    Hi Michael,
    You can use OBEO, Zimbra,Lightning or Caldav to connect to Beehive Online calendar, your customer too can use these clients. Calendar notification emails will come in your ST Beehive account, which will have an ics file as attachment. If required you can also add the external event to your ST Beehive calendar.
    Please refer to this link for client access information
    https://beehiveonline.oracle.com/External_02.html
    Thanks,
    Jereen

  • Special characters in XML built using the DOM object

    I am using the DOM object to build xml but I am having problems with special characters. I have a Element object that I create attributes in. Most special characters like the &, ", or ' are translated for me (amp; quot;, acute; put a & in front of those, if I do it here the browser will translate them into the logical character) but I am having a problem with the � character. The DOM object does not translate this. If I do it my self to(eacute; same here add a & in front) before adding the string to the attribute then the DOM object translates it to (amp;eacute; add a & in front of the amp; not in front of the eacute;). As you can see the DOM object translates the & instead of recognizing that it is a HTML character. Can anyone give me a hand?

    I am building this XML in a servlet so ,right, DOM does process XML (even though a valid HTML file can be loaded into a DOM object) but if you build XML using DOM then write the XML out using PrintWriter and Transformer objects this will cause the XML to print out in your browser. If you view source on this XML you will see that the DOM object has translated all special characters to there &xxxx; equivalent. For a example: when the string (I know "cool" java) gets loaded into a attribute using the DOM object then wrote back out it looks like (I know &xxx;cool&xxx; java) if you view the source in your browser. This is what it should do, but the DOM object is not change the � to the "&xxxxx;". This servlet is acting as a gateway between a Java API and a windows asp. The asp will call the servlet expecting to get XML back and load it directly into a DOM object. When the windows DOM object gets the xml that I am returning in this servlet is throws a exception "invalid character" because the � was not translated to &xxxx; like the other characters were. According to the book HTML 4 in 24 hours (and other references) the eacute; or #233; are how you say "�" in HTML or XML. How do you say it?

  • What is the best practice for using the Calendar control with the Dispatcher?

    It seems as if the Dispatcher is restricting access to the Query Builder (/bin/querybuilder.json) as a best practice regarding security.  However, the Calendar relies on this endpoint to build the events for the calendar.  On Author / Publish this works fine but once we place the Dispatcher in front, the Calendar no longer works.  We've noticed the same behavior on the Geometrixx site.
    What is the best practice for using the Calendar control with Dispatcher?
    Thanks in advance.
    Scott

    Not sure what exactly you are asking but Muse handles the different orientations nicely without having to do anything.
    Example: http://www.cariboowoodshop.com/wood-shop.html

  • Can't create table that grows using the button object

    Im a beginner, and this seems like a simple issue. Appreciate your help in advance.  When I try to do this, the button fails to add a row.
    So, I printed out the Help section entitled, "create a table that grows using the button object" and started from scratch with a simple table as the only object on the form- and followed the instructions to the letter.
    When I go to preview and click the button, a row is not added.
    Can you suggest something?

    Try this:
    Select body row of table from hierarchy palette that you want to repeat then on he object tab of the properties tab select binding tab. You need to click on "Repeat Row for Each Data Item"
    I hope this helps
    Murat
    www.muratkuru.com.tr

  • Can't use the Calendar, Book, and Card functions

    I have updated my iLife programs to iLife 08 and cannot use the Calendar, Book, and Card functions as the program says the themes have not been installed. However, after looking in the Library/Applications Support/iPhoto folder, the themes are there but not being recognized by the program. I have reinstalled iLife 08 but still to no avail. Help!

    Grant:
    Try the following:
    A. look for a folder title Themes in the User/Library/Application Support/iPhoto folder. If you find one there move it to the HD/Library/Application Support/iPhoto folder and reboot.
    If that doesn't jump start iPhoto then go on to B.
    B.
    Restoring iPhoto Themes
    1 - delete the current application.
    2 - delete any files with iPhoto in the file name that reside in your HD/Library/Receipts folder.
    3 - delete the Themes folder from your User/Library/Application Support/iPhoto folder.
    Also look in the HD/Library/Application Support/iPhoto folder for a Themes folder. If there is one there then delete it also.
    5 - boot into the system disk that came with your computer and do a custom install selecting only iPhoto.
    After installing reinstall the iPhoto 7.1.1 updater again followed by a repair of disk permissions with Disk Utility. Also make sure you're running the latest Quicktime, 7.3.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • RE: Using the Currency Object

    Hi
    I tried using the currency object to display the currency symbol for the UK and Europe, here is an example of what I did
    String currency = Currency.getInstance("EUR").getSymbol();
    or for the UK
    String currency = Currency.getInstance("GBR").getSymbol();
    but I ended up with unicode characters instead of currency symbols like this � or � what am i doing wrong

    (I guess you made a little typo, the Great Britain Pound is GBP and not GBR.)
    Currency.getSymbol returns the symbol that should be used for that currency in the current locale. So if you are in UK "GBP" comes out as the sterling pound symbol, in countries where they use Euro it comes out as &euro;, but everywhere else the result is the three letter (?) currency code itself. This is because pounds and dollars are used in many countries and they have the same symbol; you wouldn't want users to confuse US dollars with Canadian dollars. So try these:
    String pound = Currency.getInstance("GBP").getSymbol(new Locale("en", "GB"));
    String euro = Currency.getInstance("EUR").getSymbol(new Locale("fr", "FR"));

  • Any ideas how I can insert a pdf into word, using the insert object option. However the pdf i want to insert has text and lines annotated, but once inserted the comments don't appear????  any help would be greatly appreciated.

    Any ideas how I can insert a pdf into word, using the insert object option. However the pdf i want to insert has text and lines annotated, but once inserted the comments don't appear????  any help would be greatly appreciated.

    You will need to find a forum for MS Word since that is the software that you are trying to manipulate in this.  If you think the processing/creation of the PDF plays a role then you should ask in the forum for the software that you are using to create the PDF.
    This forum is for issue regarding downloading and installing Adobe trial products, so in any circumstance, your issue does not fit in this forum.

  • I use iCal, my husband uses the calendar in gmail. Fro months no problems on invites and acceptances. Now if he invites me I am no longer offered an acceptance and it is not visible on my calendar unless I link his gmail calendar which I do not wish to do

    I use iCal, my husband uses the calendar in gmail. For months we had no problems. Recently, he will send me invites and I no longer have the ability to accept or decline. The only way to see the event is if I link is gmail calendar which I do not wish to do. Any solutions?

    I've been using iCloud since it's inception as "mac.com" or whatever it was called. I've been able to Sync Outlook Exchange Calenars to my iMac, iPhone and iPad. However, I cannot get iCal (when viewed in iCloud) to display Exchange or Google Calender items.
    It's odd, all other Mac versions of iCal are happy e.g. iMac, MacBook Air, iPad Air, iPhone etc. But nothing when I login to icloud.com and look at the iCal there.

  • Error in Application.Run(DisplayLoginForm) and Remote Authentication in SharePoint Online Using the Client Object Model

    Hi guys
    I Think that is a simple error, but I don’t have enough knowledge in .NET apps.
    I make an console app that use Remote Authentication in SharePoint Online Using the Client Object Model, that a I downloaded from MSDN.
    This App run ok.
    But when I like to make a Windows From App. This component send me an error in Application.Run(DisplayLoginForm)
    This err msg :
     An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
    Additional information: Starting a second message loop on a single thread is not a valid operation. Use Form.ShowDialog instead.
    Is there any way to use a form inside a windows form?
    Thank in advance
    Ramiro
    Ramiro B

    Hi,
    Based on the error message, please do as following:
    1. Check your code logic below:
    void btn_Click(object sender, System.EventArgs e)
    Thread t = new Thread(StartMyForm);
    t.TrySetApartmentState(ApartmentState.STA);
    t.Start();
    public static void StartMyForm()
    Application.Run(new MyForm(..));
    2.Try to add the following code line in your code.
    Application.Restart();
    If the issue still exists, please provide your requirement and code for a further research.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • HT201269 I am trying to set up my new iPhone 5c using the iTunes backup from my iPhone4. It keeps getting stuck of step 2 of 5 "syncing calendars". I waited 18 hours last time and have restarted but the same thing is happening. I hardly use the calendar a

    Trying to set up my new iphone 5c using the iTunes back up from my iPhone 4. It keeps getting stuck on step 2 of 5 "syncing calendars" Considering I hardly use the calendar I don't know why it would take so long. (18 hours and counting)
    Any advice would be greatly appreciated!

    Did you ever resolve the iCloud problem.I am in the same position and its driving me mad!!! If you have a link to an solution I would appreciate it.

  • BILL OF MATERIAL USING THE DI OBJECT

    Hi All,
    IS IT POSSIBLE TO ADD THE BILL OF MATERIAL USING THE DI OBJECT.....
    Thanks,
    MADHUSUDHANA RAO.G

    Hi,
    Its very much possible, check the following from the sdk DI help file..
    ProductTrees is a business object that represents a completed product made up of parts and raw materials, which is described by means of a bill of materials.
    Hope it helps,
    Vasu Natari

  • Using the circle object

    My apologies if there is a simple answer to this question, but this is my first time using this program.
    I am trying to create a form from a word document and when I am in LC Designer and want to add the circle object, it is grayed out and the tooltip says: this type of object cannot be used in forms with PDF artwork.
    Can someone please tell me:
    1. What is PDF artwork?
    2. Is there a way to show what the PDF artwork in the form is?
    Thank you for your help.

    When you created the PDF in the first place you would have been given options of either creating an "Interactive Form with Fixed Pages" or an "Interactive form with a Flowable Layout". Sounds like you chose the former. If you want to be able to use the drawing objects you need to choose the "Flowable Layout" option. However, you will have to spend some time cleaning up the layout, since the import process isn't perfect.

Maybe you are looking for

  • How to change the column order in the DB?

    Hi all, For example,      there is an employee database with the field names empno(1),empname(2), empphone(3), empaddress(4), empsal(5). the values in the brackets are the column order i.e., the order in which the column names are placed.      I have

  • Weird print/pdf error when images are over a table

    Hi all I'm having a trouble with Pages where if I have an image over a table (so it looks like it's in the box) it can cause the table borders to go missing. As this is a little hard to describe I have made a pdf file showing the problem... http://ho

  • Difference between domain controllers and group policy objects in GPMC

    Hello, Am in confusion, someone can tel me the difference between 1.Domain controllers>default domain controller policy  and 2.Group policy object>default domain controller policy In Group policy management console and also i would like know where to

  • Error while downloading/installing Updates of Photoshop CS5 ... What's going wrong?  (ger/eng)

    While updating Photoshop CS5, the following errors appear.. I tried it again and again... Day after day but still the same problem.. Hope someone is able to help? (sorry for my bad english, I'm german ) "Some updates couldn't be installed. Following

  • Defrag?

    I was using iMovie 9.0.2 for a good month or so almost every day and noticed that after working on a fairly complex movie, the "skimming" feature became very slow, almost unresponsive and jerky. This just happened in the last few days. I went back to