| | |
| | | } |
| | | 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 |
| | | * |
| | |
| | | } |
| | | int nday = caln.get(Calendar.DAY_OF_YEAR); |
| | | days = days + nday - oday; |
| | | |
| | | return days; |
| | | } |
| | | |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | System.out.println(RandomStringUtils.randomNumeric(3)); |
| | | Date date = getISO8601DateByStr("2024-02-21T15:46:36.014+08:00"); |
| | | System.out.println(getISO8601Timestamp(date)); |
| | | |
| | | |
| | | Date date = getISO8601DateByStr("2024-04-15T07:46:36.014+08:00"); |
| | | Date date1 = getISO8601DateByStr("2024-06-14T08:46:36.014+08:00"); |
| | | System.out.println(daysBetweenDates11(date1,date)+1); |
| | | |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |