im having a hard time trying to change this print statement into a variable for comparing with other variables.
Is there a way to store the output as a variable instead of printing incase you need to determine the difference of two dates?
import java.util.GregorianCalendar;
import java.util.Calendar;
public class Test {
public static void main(String[] args){
int Day = 8;
int Month = 2;
int Year = 1950;
GregorianCalendar gcal = new GregorianCalendar(Year, Month, Day);
String month[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
System.out.println(month[gcal.get(Calendar.MONTH)] + " " + gcal.get(Calendar.DATE) + ", "
+ gcal.get(Calendar.YEAR));}
}
This output prints: Mar 8, 1950