package com.gblfy.util;import java.util.Calendar;
import java.util.GregorianCalendar;
public class TimeUtil {public TimeUtil() {}public static String getCurrentDate(){GregorianCalendar tGCalendar = new GregorianCalendar();int sYears = tGCalendar.get(Calendar.YEAR);int sMonths = tGCalendar.get(Calendar.MONTH) + 1;int sDays = tGCalendar.get(Calendar.DAY_OF_MONTH);StringBuffer tStringBuffer = new StringBuffer(10);tStringBuffer.append(sYears);tStringBuffer.append('-');if(sMonths < 10) {tStringBuffer.append('0');}tStringBuffer.append(sMonths);tStringBuffer.append('-');if(sDays < 10) {tStringBuffer.append('0');}tStringBuffer.append(sDays);return tStringBuffer.toString();}public static String getCurrentTime(){GregorianCalendar tGCalendar = new GregorianCalendar();int sHOUR = tGCalendar.get(Calendar.HOUR_OF_DAY);int sMINUTE = tGCalendar.get(Calendar.MINUTE);int sSECOND = tGCalendar.get(Calendar.SECOND);StringBuffer tStringBuffer = new StringBuffer(8);if(sHOUR < 10) {tStringBuffer.append('0');}tStringBuffer.append(sHOUR);tStringBuffer.append(':');if(sMINUTE < 10) {tStringBuffer.append('0');}tStringBuffer.append(sMINUTE);tStringBuffer.append(':');if(sSECOND < 10) {tStringBuffer.append('0');}tStringBuffer.append(sSECOND);return tStringBuffer.toString();}
}