Search in sources :

Example 66 with SimpleDateFormat

use of java.text.SimpleDateFormat in project translationstudio8 by heartsome.

the class DateUtilsBasic method getStringToday.

/**
	 * 得到现在的时间字符串.
	 * @return String
	 * 				时间字符串格式 yyyyMMdd HHmmss
	 */
public static String getStringToday() {
    Date currentTime = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
    String dateString = formatter.format(currentTime);
    return dateString;
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 67 with SimpleDateFormat

use of java.text.SimpleDateFormat in project translationstudio8 by heartsome.

the class DateUtilsBasic method strToDateLong.

/**
	 * 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss.
	 * @param strDate
	 *            	指定的日期字符串
	 * @return Date
	 * 				返回时间类型 yyyy-MM-dd HH:mm:ss
	 */
public static Date strToDateLong(String strDate) {
    if (strDate == null) {
        return null;
    }
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    ParsePosition pos = new ParsePosition(0);
    Date strtodate = formatter.parse(strDate, pos);
    return strtodate;
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) ParsePosition(java.text.ParsePosition)

Example 68 with SimpleDateFormat

use of java.text.SimpleDateFormat in project translationstudio8 by heartsome.

the class DateUtilsBasic method getHour.

/**
	 * 得到现在小时.如当前时间为 14:45:55,则返回 14
	 * @return String
	 * 				当前时间的小时数
	 */
public static String getHour() {
    Date currentTime = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String dateString = formatter.format(currentTime);
    String hour;
    hour = dateString.substring(11, 13);
    return hour;
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 69 with SimpleDateFormat

use of java.text.SimpleDateFormat in project translationstudio8 by heartsome.

the class DateUtilsBasic method dateToStrLong.

/**
	 * 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss.
	 * @param dateDate
	 *            	指定的日期
	 * @return String
	 * 				返回时间字符串 yyyy-MM-dd HH:mm:ss
	 */
public static String dateToStrLong(java.util.Date dateDate) {
    if (dateDate == null) {
        dateDate = new Date();
    }
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String dateString = formatter.format(dateDate);
    return dateString;
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 70 with SimpleDateFormat

use of java.text.SimpleDateFormat in project translationstudio8 by heartsome.

the class DateUtilsBasic method getTimeShort.

/**
	 * 获取时间 小时:分;秒 HH:mm:ss.
	 * @return String
	 * 				返回短时间字符串格式 HH:mm:ss.
	 */
public static String getTimeShort() {
    SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
    Date currentTime = new Date();
    String dateString = formatter.format(currentTime);
    return dateString;
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

SimpleDateFormat (java.text.SimpleDateFormat)3363 Date (java.util.Date)1843 ParseException (java.text.ParseException)559 DateFormat (java.text.DateFormat)526 Test (org.junit.Test)399 Calendar (java.util.Calendar)341 ArrayList (java.util.ArrayList)317 File (java.io.File)253 IOException (java.io.IOException)223 GregorianCalendar (java.util.GregorianCalendar)143 HashMap (java.util.HashMap)132 Locale (java.util.Locale)82 Map (java.util.Map)74 TimeZone (java.util.TimeZone)67 DateField (edu.uci.ics.textdb.api.field.DateField)64 DoubleField (edu.uci.ics.textdb.api.field.DoubleField)64 IField (edu.uci.ics.textdb.api.field.IField)64 IntegerField (edu.uci.ics.textdb.api.field.IntegerField)64 List (java.util.List)64 StringField (edu.uci.ics.textdb.api.field.StringField)63