davidchew
May 2nd, 2000, 07:32 PM
My previous posting may not be clear.
let say I think of a date 14/03/1974 23hr 10min, 3sec
Date startdate = new Date()
How do I set startdate to the above date ?
bharath
May 2nd, 2000, 11:19 PM
hai,
U can use the constructor method like-
Date date=new Date(int year,
int month,
int date,
int hrs,
int min,
int sec)
Note: Date() is deprecated. As of JDK version 1.1, replaced by Calendar.set(year + 1900, month, date, hrs, min, sec) or GregorianCalendar(year + 1900, month, date, hrs, min, sec).
Allocates a Date object and initializes it so that it represents the specified hour, minute, and second, local time of the date specified by the year, month, date, hrs, min, and sec arguments.
Parameters:
year - the year minus 1900.
month - the month between 0-11.
date - the day of the month between 1-31.
hrs - the hours between 0-23.
min - the minutes between 0-59.
sec - the seconds between 0-59.
Or.
if u have alreaddy declared a date object u can use setDate() setHour serMinutes setSeconds(),
setDate() setYear() setMonth() for having ur date set
hope u got wat u wanted
-bharath
S.V Bharath Reddy
Software Engineer,
Hyderabad.