コード例 #1
0
ファイル: TimeUtils.java プロジェクト: hwdlei/common-utils
 public static Date tranSinaApiDate(String timeStr) {
   try {
     return DateFormatterThreadLocal.getSinaApiDateFormat().parse(timeStr);
   } catch (ParseException e) {
     logger.error("Exception:{}", LogbackUtil.expection2Str(e));
     throw new RuntimeException(e);
   }
 }
コード例 #2
0
ファイル: TimeUtils.java プロジェクト: hwdlei/common-utils
 /**
  * 将"2014-08-25 00:00:00"转换为long型时间戳
  *
  * @param str
  * @return
  */
 public static long transTimeLong(String str) {
   try {
     Date date = DateFormatterThreadLocal.getLongDateFormat().parse(str);
     return date.getTime();
   } catch (ParseException e) {
     logger.error("Exception:{}", LogbackUtil.expection2Str(e));
     throw new RuntimeException(e);
   }
 }
コード例 #3
0
ファイル: TimeUtils.java プロジェクト: hwdlei/common-utils
 public static long transSolrReturnStrToMilli(String str) {
   try {
     return DateFormatterThreadLocal.getSolrReturnDateFormat().parse(str).getTime();
   } catch (ParseException e) {
     logger.error("Exception:{}", LogbackUtil.expection2Str(e));
     return 0L;
     //			throw new RuntimeException();
   }
 }
コード例 #4
0
ファイル: TimeUtils.java プロジェクト: hwdlei/common-utils
 /** 将Solr返回的时间串转换成可读性较好的格式 如:Thu Apr 10 11:40:56 CST 2014——>2014-04-10 10:07:14 */
 public static String transStrToCommonDateStr(String str) {
   try {
     return DateFormatterThreadLocal.getLongDateFormat()
         .format(DateFormatterThreadLocal.getSolrReturnDateFormat().parse(str));
   } catch (ParseException e) {
     logger.error("Exception:{}", LogbackUtil.expection2Str(e));
     return "";
     //			throw new RuntimeException();
   }
 }
コード例 #5
0
ファイル: Configs.java プロジェクト: mqwHub/kafka-client
 static {
   logger.info("Load resource: kafka.properties");
   try (InputStream in =
       ConfigUtil.class.getClassLoader().getResourceAsStream("kafka.properties"); ) {
     props.load(in);
     logger.info("kafka properties : " + props.toString());
   } catch (Exception e) {
     logger.error("Exception:{}", LogbackUtil.expection2Str(e));
     throw new RuntimeException(e);
   }
 }