當前位置: 首頁>>代碼示例>>Java>>正文


Java ParseException.printStackTrace方法代碼示例

本文整理匯總了Java中java.text.ParseException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseException.printStackTrace方法的具體用法?Java ParseException.printStackTrace怎麽用?Java ParseException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.text.ParseException的用法示例。


在下文中一共展示了ParseException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showOpenHomework

import java.text.ParseException; //導入方法依賴的package包/類
/***** MVP View methods implementation *****/
@Override
public void showOpenHomework(@NonNull Pair<String, String> openHomework) {
    Date date = null;
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
    SimpleDateFormat simpleDateFormatDeux = new SimpleDateFormat("yyyy-MM-dd  HH:mm");
    try {
        date = simpleDateFormat.parse(openHomework.getSecond());
    } catch (ParseException e) {
        e.printStackTrace();
    }
    openTasks.setText(openHomework.getFirst());
    if (openHomework.getSecond().equals("10000-01-31T23:59"))
        dueTillDate.setText("...");
    else
        dueTillDate.setText(simpleDateFormatDeux.format(date));
    cardViewHomework.setOnClickListener(v -> addFragment(HomeworkFragment.newInstance()));
}
 
開發者ID:schul-cloud,項目名稱:schulcloud-mobile-android,代碼行數:19,代碼來源:DashboardFragment.java

示例2: formMessage

import java.text.ParseException; //導入方法依賴的package包/類
public String formMessage(String content) {
    try {
        JsonObject contentObj = new JsonParser().parse(content).getAsJsonObject();
        int userId = contentObj.get("uid").getAsInt();
        String datetime = contentObj.get("datetime").getAsString();
        SimpleDateFormat insdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
        SimpleDateFormat outsdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String parsedDatetime = outsdf.format(insdf.parse(datetime));
        String chatContent = contentObj.get("content").getAsString();
        String username = userDao.getUserById(userId).getUsername();
        String avatar = userDao.getUserById(userId).getAvatar();

        JsonObject messageJson = new JsonObject();
        messageJson.addProperty("uid", userId);
        messageJson.addProperty("username", username);
        messageJson.addProperty("datetime", parsedDatetime);
        messageJson.addProperty("avatar", avatar);
        messageJson.addProperty("content", chatContent);
        return messageJson.toString();
    } catch (ParseException e) {
        e.printStackTrace();
        return "error";
    }
}
 
開發者ID:qinjr,項目名稱:TeamNote,代碼行數:25,代碼來源:ConvertUtilImpl.java

示例3: getFmt_DT_T_SumStr

import java.text.ParseException; //導入方法依賴的package包/類
/**
 * 返回格式化的日期時間字串
 * 
 * @param strDateTime0
 *            日期時間,"yyyy-MM-dd HH:mm"
 * @param strTime1
 *            時間,"HH:mm"
 * @return strDateTime0+strTime1返回"yyyy-MM-dd HH:mm"格式字符串
 */
public static String getFmt_DT_T_SumStr(String strDateTime0, String strTime1) {
	SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm",
			Locale.getDefault());
	Date date1 = null;
	try {
		date1 = df1.parse(strDateTime0);
	} catch (ParseException e1) {
		e1.printStackTrace();
	}
	Calendar c = Calendar.getInstance(Locale.getDefault());
	c.setTime(date1);
	String[] strTimes2 = strTime1.split(":");
	c.add(Calendar.HOUR_OF_DAY, Integer.valueOf(strTimes2[0]));
	c.add(Calendar.MINUTE, Integer.valueOf(strTimes2[1]));
	SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm",
			Locale.getDefault());
	return df2.format(c.getTime());
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:28,代碼來源:TimeUtil.java

示例4: getCredentialString

import java.text.ParseException; //導入方法依賴的package包/類
@Test
public void getCredentialString() {
    ClientConfig config = new ClientConfig.Builder().accessKey("TESTESTSERSERESTSET").secretKey("KJSAKDFJASKFDJASDFJSAFDJSJFSAJFSDF").build();

    Auth auth = new Auth(config);
    String body = "";

    SimpleDateFormat ISO8601DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    ISO8601DATEFORMAT.setTimeZone(TimeZone.getTimeZone("GMT+0"));
    String date_s = "2017-10-28T19:57:56";
    Date date = new Date();
    try {
        date = ISO8601DATEFORMAT.parse(date_s);
    } catch (ParseException e) {
        e.printStackTrace();
    }

    String a = auth.getCredentialString("POST", "/v2/kernel/create", date, body);
    assertEquals(a, "TESTESTSERSERESTSET:dcd926f4b281e05d384b3debccd540b1cd9ad30c184f5797057616f3b86b2cc3");

}
 
開發者ID:lablup,項目名稱:backend.ai-client-java,代碼行數:22,代碼來源:AuthTest.java

示例5: clickSubmit

import java.text.ParseException; //導入方法依賴的package包/類
public void clickSubmit(View v) {
    if (mTimeSelectListener != null) {
        try {
            Date date = WheelTime.dateFormat.parse(mWheelTime.getTime());
            mTimeSelectListener.onTimeSelect(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
    dismiss();
}
 
開發者ID:crazysunj,項目名稱:Android-PickerDialog,代碼行數:12,代碼來源:BaseDatePickerDialog.java

示例6: s2d

import java.text.ParseException; //導入方法依賴的package包/類
public static Date s2d(String dateStr) {
    Date date = new Date();
    try {
        date = new SimpleDateFormat(LEAN_FORMAT, Locale.CHINA).parse(dateStr);
    } catch (ParseException e) {
        e.printStackTrace();
    }

    return date;
}
 
開發者ID:linsir6,項目名稱:TripBuyer,代碼行數:11,代碼來源:DateUtil.java

示例7: farmatTime

import java.text.ParseException; //導入方法依賴的package包/類
public static Long farmatTime(String string) {
    Date date = null;
    try {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        date = Date(sf.parse(string));
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return date.getTime();
}
 
開發者ID:wutongke,項目名稱:AndroidSkinAnimator,代碼行數:11,代碼來源:TimeUtil.java

示例8: getBetweenTodaysStartDateAndEndDate

import java.text.ParseException; //導入方法依賴的package包/類
public static int getBetweenTodaysStartDateAndEndDate(Date startDate, Date endDate) {
    byte betweentoday = 0;
    if(startDate == null) {
        return betweentoday;
    } else {
        if(endDate == null) {
            Calendar calendar = Calendar.getInstance();
            String year = Integer.toString(calendar.get(Calendar.YEAR));
            String month = Integer.toString(calendar.get(Calendar.MONTH) + 1);
            String day = Integer.toString(calendar.get(Calendar.DATE));
            String strtodaytime = year + "-" + month + "-" + day;
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

            try {
                endDate = formatter.parse(strtodaytime);
            } catch (ParseException var10) {
                var10.printStackTrace();
            }
        }

        int betweentoday1;
        if(endDate.after(startDate)) {
            betweentoday1 = (int)((endDate.getTime() - startDate.getTime()) / 86400000L);
        } else {
            betweentoday1 = (int)((startDate.getTime() - endDate.getTime()) / 86400000L);
        }

        return betweentoday1;
    }
}
 
開發者ID:ZHENFENG13,項目名稱:My-Blog,代碼行數:31,代碼來源:DateKit.java

示例9: parseDate

import java.text.ParseException; //導入方法依賴的package包/類
public static Date parseDate(String time, String pattern, Locale local) {
    SimpleDateFormat format = new SimpleDateFormat(pattern, local);
    try {
        return format.parse(time);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:Wangsu-Cloud-Storage,項目名稱:wcs-android-sdk,代碼行數:10,代碼來源:DateUtil.java

示例10: getDateFormate

import java.text.ParseException; //導入方法依賴的package包/類
/**
 * Change format of date.
 *
 * @param dateTime:   notification date which is converted to local from GMT.
 * @param newFormate: Need to convert format.
 * @return: date with format.
 */
private static String getDateFormate(String dateTime, String newFormate) {
    DateFormat inputFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    DateFormat outputFormate = new SimpleDateFormat(newFormate + " 'at' " + "hh:mm aa");
    try {
        Date date = inputFormate.parse(dateTime);
        String outputDateWithFormate = outputFormate.format(date);
        return outputDateWithFormate;
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return "";
}
 
開發者ID:QuixomTech,項目名稱:DeviceInfo,代碼行數:20,代碼來源:Methods.java

示例11: changedatetime

import java.text.ParseException; //導入方法依賴的package包/類
public long changedatetime(String dateStr) {
	SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
	Date date;

	try {
		date = format.parse(dateStr);
		return date.getTime();
	} catch (ParseException e) {
		e.printStackTrace();
	}
	return 0;
}
 
開發者ID:z9961,項目名稱:DoList,代碼行數:13,代碼來源:Festival.java

示例12: toAmPm

import java.text.ParseException; //導入方法依賴的package包/類
/**
 * Returns the time in AM PM format
 * @param time to convert
 * @return the time in AM PM format
 */
private String toAmPm(String time) {
    String hourStr = "";
    DateFormat readFormat = new SimpleDateFormat("HH:mm:ss");
    DateFormat writeFormat = new SimpleDateFormat("hh:mm a");
    try {
        hourStr = writeFormat.format(readFormat.parse(time));
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return hourStr;
}
 
開發者ID:chrisqz95,項目名稱:couch-potatoes,代碼行數:17,代碼來源:MessageActivity.java

示例13: getDayBefore

import java.text.ParseException; //導入方法依賴的package包/類
public static Date getDayBefore(Date date, int days){
    calendar.setTime(date);
    calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) - days);
    try {
        date = format.parse(format.format(calendar.getTime()));
    }catch (ParseException e){
        e.printStackTrace();
    }
    return date;
}
 
開發者ID:SirLYC,項目名稱:Android-Gank-Share,代碼行數:11,代碼來源:TimeUtil.java

示例14: setDate

import java.text.ParseException; //導入方法依賴的package包/類
/**
 * Initialise la date
 */
public void setDate(String cs) 
{
	DateFormat df = DateFormat.getInstance() ;
	Date date ;
	try
	{
		date = df.parse(cs);
		calendar.setTime(date);
	} 
	catch (ParseException e)
	{
		e.printStackTrace();
	}
}
 
開發者ID:costea7,項目名稱:ChronoBike,代碼行數:18,代碼來源:DateUtil.java

示例15: getHM

import java.text.ParseException; //導入方法依賴的package包/類
public static String getHM(String date) {
	SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	SimpleDateFormat ft1 = new SimpleDateFormat("HH:mm");
	Date date1 = null;
	try {
		date1 = ft.parse(date);
	} catch (ParseException e) {
		e.printStackTrace();
		return "";
	}

	return ft1.format(date1);
}
 
開發者ID:ebridfighter,項目名稱:GongXianSheng,代碼行數:14,代碼來源:TimeUtils.java


注:本文中的java.text.ParseException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。