/**
* Get the current time of the server
* Press Enter: Date and Time
*/
Import java. util .*;
Public class getnowdate {
Calendar calendar = NULL;
Public getnowdate (){
Calendar = calendar. getinstance ();
Calendar. settime (new date ());
}
Public int getyear (){
Return calendar. Get (calendar. year );
}
Public int getmonth (){
Return 1 + calendar. Get (calendar. month );
}
Public int getday (){
Return calendar. Get (calendar. day_of_month );
}
Public int gethour (){
Return calendar. Get (calendar. hour_of_day );
}
Public int getminute (){
Return calendar. Get (calendar. Minute );
}
Public int getsecond (){
Return calendar. Get (calendar. Second );
}
Public String getdate (){
Return getmonth () + "/" + getday () + "/" + getyear ();
}
Public String gettime (){
Return gethour () + ":" + getminute () + ":" + getsecond ();
}
Public String getdate2 (){
String yyyy = "0000", Mm = "00", DD = "00 ";
Yyyy = yyyy + getyear ();
Mm = mm + getmonth ();
Dd = dd + getday ();
Yyyy = YYYY. substring (YYYY. Length ()-4 );
Mm = mm. substring (Mm. Length ()-2 );
Dd = dd. substring (DD. Length ()-2 );
Return yyyy + "/" + mm + "/" + dd;
}
Public String gettime2 (){
String HH = "00", Mm = "00", Ss = "00 ";
HH = HH + gethour ();
Mm = mm + getminute ();
Ss = SS + getsecond ();
HH = HH. substring (HH. Length ()-2, HH. Length ());
Mm = mm. substring (Mm. Length ()-2, mm. Length ());
Ss = ss. substring (ss. Length ()-2, SS. Length ());
Return HH + ":" + mm + ":" + SS;
}
}