List of usage examples for java.text SimpleDateFormat SimpleDateFormat
public SimpleDateFormat(String pattern, DateFormatSymbols formatSymbols)
SimpleDateFormat
using the given pattern and date format symbols. From source file:Main.java
public static void main(String[] args) { String[] newMonths = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" }; String[] newShortMonths = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" }; String[] newWeekdays = { "", "Monday", "Tuesday", "Webnesday", "Thursday", "Friday", "Saturaday", "Sunday" }; String[] shortWeekdays = { "", "monday", "tuesday", "webnesday", "thursday", "friday", "saturaday", "sunday" }; DateFormatSymbols symbols = new DateFormatSymbols(); symbols.setMonths(newMonths);//from w w w .j a va2 s . c om symbols.setShortMonths(newShortMonths); symbols.setWeekdays(newWeekdays); symbols.setShortWeekdays(shortWeekdays); DateFormat format = new SimpleDateFormat("dd MMMM yyyy", symbols); System.out.println(format.format(new Date())); format = new SimpleDateFormat("dd MMM yyyy", symbols); System.out.println(format.format(new Date())); format = new SimpleDateFormat("EEEE, dd MMM yyyy", symbols); System.out.println(format.format(new Date())); format = new SimpleDateFormat("E, dd MMM yyyy", symbols); System.out.println(format.format(new Date())); }
From source file:com.traffic.common.utils.http.HttpClientUtils.java
public static void main(String[] args) { //cst??GMT?/*from w ww . j ava 2 s . c o m*/ DateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH); format.setTimeZone(TimeZone.getTimeZone("GMT")); String date = format.format(new Date()); String s = "license_plate_num=%E7%B2%A4BA804D&engine_num=C32764&body_num=064484&city_pinyin=shenzhen"; //?? String SIGNATURE = MD5Encrypt.encrypt("POST&/v3/violations&" + date + "&" + s.length() + "&" + MD5Encrypt.encrypt("uTIYrJn6vJTyt1ztBNbqQQDexDjpAM4m")); // headers.put("Host", "api.buding.cn"); headers.put("Authorization", "dLSQ1ZjK7exqlwqx:" + SIGNATURE); headers.put("Date", date); JSONObject reqParam = new JSONObject(); reqParam.put("license_plate_num", "BA804D"); reqParam.put("engine_num", "C32764"); reqParam.put("body_num", "064484"); reqParam.put("city_pinyin", "shenzhen"); String respBody = HttpClientUtils.httpPost_JSONObject("http://api.buding.cn/v3/violations", reqParam); System.out.println(JSONObject.parse(respBody)); }
From source file:Main.java
public static SimpleDateFormat getTimeFormat() { return new SimpleDateFormat("HH:mm", Locale.getDefault()); }
From source file:Main.java
public static String getTime() { return new SimpleDateFormat("MM-dd HH:mm", Locale.CHINA).format(new Date()); }
From source file:Main.java
public static String FormatDate(Date d) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", java.util.Locale.getDefault()); return sdf.format(d); }
From source file:Main.java
public static String getDate(long milliSeconds) { SimpleDateFormat formatter = new SimpleDateFormat("EEEE dd MMMM yyyy", Locale.FRANCE); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliSeconds); return formatter.format(calendar.getTime()); }
From source file:Main.java
public static String getHour(long milliSeconds) { SimpleDateFormat formatter = new SimpleDateFormat("kk:mm", Locale.FRANCE); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(milliSeconds); return formatter.format(calendar.getTime()); }
From source file:Main.java
private static String getTImeStamp() { return new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date()); }
From source file:Main.java
public static SimpleDateFormat getDateFormat() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.US); format.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); return format; }
From source file:Main.java
public static SimpleDateFormat getDateFormat() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US); format.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); return format; }