S
Sameer
Please watch the following code:
(Though the constructor Date(int year, int month, int date) was
deprecated)
Note that I am creating a date object for the date 1 July 2006.
import java.util.*;
import java.text.*;
//The date is represented as a Date object or
//as the milliseconds since January 1, 1970,00:00:00 GMT.
public class DateDemo1 {
public static void main(String args[]) throws ParseException {
Date date= new Date(2006,7,1);
System.out.println("String representation of current
date:"+date.toString());
}
}
The output is
String representation of current date:Wed Aug 01 00:00:00 IST 3906
Am I wrong? What may be the problem?
How to create Date instance for desired date?
(Though the constructor Date(int year, int month, int date) was
deprecated)
Note that I am creating a date object for the date 1 July 2006.
import java.util.*;
import java.text.*;
//The date is represented as a Date object or
//as the milliseconds since January 1, 1970,00:00:00 GMT.
public class DateDemo1 {
public static void main(String args[]) throws ParseException {
Date date= new Date(2006,7,1);
System.out.println("String representation of current
date:"+date.toString());
}
}
The output is
String representation of current date:Wed Aug 01 00:00:00 IST 3906
Am I wrong? What may be the problem?
How to create Date instance for desired date?