| | |
| | | try { |
| | | TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai"); |
| | | //TimeZone tz = TimeZone.getTimeZone("GMT-01"); |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+'z"); |
| | | DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+'08:00"); |
| | | df.setTimeZone(tz); |
| | | String nowAsISO = df.format(date); |
| | | return nowAsISO; |
| | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | public static String getShortTimeToNull(Date date) { |
| | | |
| | | if (date == null) |
| | | return null; |
| | | try { |
| | | String nowDate = sdfLong.format(date); |
| | | return nowDate; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ""; |
| | | } |
| | | /** |
| | | * Descrption:取得当前日期,格式为:yyyy-MM-dd HH:mm:ss |
| | | * |