Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-22-2009, 03:23 PM
Member
 
Join Date: Apr 2009
Posts: 7
Rep Power: 0
KeeFy is on a distinguished road
Default [SOLVED] Calendar help
I got a date formated as YY,MM,DD as data in thedates. Problem is how do i get it to set into the Calendar? It seems i can't use any variables?

Thanks in advance!


Code:
     Calendar abcd = Calendar.getInstance();
     int typeofchart = 1;                           // SETS THE TYPE OF CHART
     String datestrip[] = thedates.split(",");
     //abcd.set (2006,5,30);                       
      // abcd.set(datestrip[0],datestrip[1],datestrip[2]);
       //abcd.setTime(thedates);

       abcd.set(Calendar.YEAR, datestrip[0]);
       abcd.set(Calendar.MONTH, datestrip[1]);
       abcd.set(Calendar.DATE, datestrip[2]);
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 04-22-2009, 03:26 PM
Member
 
Join Date: Apr 2009
Posts: 7
Rep Power: 0
KeeFy is on a distinguished road
Default
Nevermind! I took one more look at the class and i realised it should be in int! Silly mistake. Thanks.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-22-2009, 03:28 PM
PhHein's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Germany
Posts: 491
Rep Power: 1
PhHein is on a distinguished road
Default
Calendar.set() takes two ints

Code:
abcd.set(Calendar.YEAR, Integer.parseInt(datestrip[0]));
abcd.set(Calendar.MONTH, Integer.parseInt(datestrip[1]));
abcd.set(Calendar.DATE, Integer.parseInt(datestrip[2]));
Edit: ok, nevermoind me then
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a calendar???? zifis New To Java 5 04-07-2009 05:04 PM
Calendar bug? Stigvig Advanced Java 14 02-08-2009 10:56 AM
calendar John SWT / JFace 12 08-07-2008 11:54 PM
How to Show Calendar praveen.kb AWT / Swing 2 02-09-2008 09:23 AM
Web calendar Daniel Enterprise JavaBeans 1 06-27-2007 06:36 PM


All times are GMT +2. The time now is 07:15 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org