Results 1 to 2 of 2
  1. #1
    santunez is offline Member
    Join Date
    Mar 2010
    Posts
    5
    Rep Power
    0

    Default Problem with compile Calendar

    Hello Friend

    I have the following code:

    -------------------------------------------------
    import java.util.*
    import java.util.Calendar;
    import java.util.Date;
    import java.util.GregorianCalendar;
    import java.util.TimeZone;

    public class gregoriano {

    /**

    * @param args the command line arguments

    */
    // Logical Attribute
    public static void main(String[] args) {

    Calendar calendar = Calendar.getInstance();
    calendar.clear();
    calendar.set(1601,0,1,0,0);
    long timeStamp = Long.parseLong(ADdate);
    timeStamp = timeStamp / 10000 + calendar.getTime().getTime();
    Date vDate= new Date(timeStamp);

    // Physical Attribute

    Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
    cal.clear();
    cal.set(1601, 0, 1, 0, 0);
    long longNum=(date.getTime() - cal.getTime().getTime()) * 10000;
    v=Long.toString(longNum);
    }
    }
    -----------------------------------------

    The code is by change the format of calendar to gregorian, but when is compiled appears the following errors

    -------------

    Building sample class
    gregoriano.java:25: cannot find symbol
    symbol : variable ADdate
    location: class com.ca.idm.samples.gregoriano
    long timeStamp = Long.parseLong(ADdate);
    ^
    gregoriano.java:34: cannot find symbol
    symbol : variable date
    location: class com.ca.idm.samples.gregoriano
    long longNum=(date.getTime() - cal.getTime().getTime()) * 10000;
    ^
    gregoriano.java:35: cannot find symbol
    symbol : variable v
    location: class com.ca.idm.samples.gregoriano
    v=Long.toString(longNum);
    ^
    3 errors
    --------------------------------------------

    Is possible obtain help, I am new in Java ):

    Best Regards

  2. #2
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    The error message is telling you exactly what is wrong. It's telling you that you're using a bunch of variables that are never declared: ADdate, date, and v.

    Solution:

    1) don't do this. Always declare and initialize a variable before you try to use it.
    2) Study what the error messages are telling you because most of the time, it will point you to what is wrong.

    Buena suerte!

Similar Threads

  1. Calendar date problem
    By groobelar in forum New To Java
    Replies: 2
    Last Post: 01-17-2010, 04:47 AM
  2. Calendar in java - problem
    By omygoodness in forum New To Java
    Replies: 7
    Last Post: 01-04-2010, 09:33 PM
  3. Calendar - problem in Cprompt
    By pinkdreammsss in forum New To Java
    Replies: 8
    Last Post: 04-14-2009, 02:09 PM
  4. Calendar language problem
    By kopros in forum New To Java
    Replies: 1
    Last Post: 10-27-2008, 11:00 PM
  5. Problem with calendar
    By Felissa in forum Advanced Java
    Replies: 2
    Last Post: 07-01-2007, 09:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •