Results 1 to 2 of 2
Thread: Problem with compile Calendar
- 05-06-2010, 12:26 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 5
- Rep Power
- 0
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
- 05-06-2010, 12:36 AM #2
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
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
-
Calendar date problem
By groobelar in forum New To JavaReplies: 2Last Post: 01-17-2010, 03:47 AM -
Calendar in java - problem
By omygoodness in forum New To JavaReplies: 7Last Post: 01-04-2010, 08:33 PM -
Calendar - problem in Cprompt
By pinkdreammsss in forum New To JavaReplies: 8Last Post: 04-14-2009, 01:09 PM -
Calendar language problem
By kopros in forum New To JavaReplies: 1Last Post: 10-27-2008, 10:00 PM -
Problem with calendar
By Felissa in forum Advanced JavaReplies: 2Last Post: 07-01-2007, 08:39 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks