/ * * Copyright (c) 2003 Shenyang Huaxin Network Property Company. All Rights * Reserved. * Public bean, generating database records primary key ID * Form: Annual monthly day, one second, one second 6 bit random * /
Package zpxx;
Import java.text.dateFormat; import java.util. *;
Public class rowautoid {Calendar Calendar = NULL; DATE CURRENTDATE
Public rowautoid () {Calendar = Calendar.GetInstance (); Date TrialTime = New Date (); Calendar.Settime (TRIALTIME);}
Public int getYear () {return caledar.get (Calendar.Year);} public string getMonth () {int m = getMonthint (); string [] months = new string [] {"01", "02", "03 "04", "05", "06", "07", "08", "09", "10", "11", "12"}; return MONTHS [M - 1];
}
Public int GETMONTHINT () {Return 1 Calendar.Get (Calendar.Mont);
Public string getdate () {return getYear () " getMonth () " " getdayofmonth ();
Public string getcurrentdate (); Calendar.SetTime (DT); return getYear () "-" getMonth () "-" getDayofmonth ();
Public string getcurrentdate (string arg1) {date dt = new date (); calendar.settime (dt); if (arg1.equals ("1")) Return getYear () "-" getMonth () "-" getDayofmonth (); else return ge-ge-read () " " " " getdayofmonth () "" getTcurrentime ();
Public string gettime () {return gethour () " getminute () " getsecond () " getMillisecond ();
public String getTCurrentime () {return getHour () ":" getMinute () ":" getSecond ();} public String getDayOfMonth () {int dayOfMonth = calendar.get (Calendar.DAY_OF_MONTH); String StrTmp; if (DayOfmonth <10) stratmp = "0" dayofmonth; else stratmp = " dayofmonth; return straTrtmp;}
Public string gethor () {int hour = calendar.get (Calendar.Hour_of_day); string stratmp; if (Hour <10) stratmp = "0" hour; else strtmp = " hour; returnut;} public string getminute () {INT minute = Calendar.get (Calendar.minute); string stratmp; if (Minute <10) stratmp = "0" minute; else stratmp = "" minute; return stratmp;}
Public string getsecond () {int second = Calendar.get (Calendar.second); string stratmp; if (Second <10) stratmp = "0" second; else straTrtmp = " second; return strtmp;}
Public int getMillisecond () {return caledar.get (calendar.millisecond);}
Public int getrandomnum () {int maxint = 1000000; Random R = new random (); int getrandomnum = r.nextint (maxint); return getrandomnum;}
Public string getdrowautoid () {return getdate () gettime () getrandomnum ();
}