From 4a465afb41431595b540addb4c8e06ced34d58d6 Mon Sep 17 00:00:00 2001 From: blankj <625783482@qq.com> Date: Tue, 16 Aug 2016 21:03:58 +0800 Subject: [PATCH] see 08/16 log --- README.md | 2 +- md/about_network.md | 3 + md/about_shell.md | 1 + md/about_size.md | 2 +- md/about_time.md | 180 ++++++------ md/update_log.md | 2 +- utilcode/build.gradle | 7 +- utilcode/project.properties | 10 + .../blankj/utilcode/utils/NetworkUtils.java | 3 + .../blankj/utilcode/utils/SDCardUtils.java | 266 +++++++++--------- .../com/blankj/utilcode/utils/ShellUtils.java | 1 + .../com/blankj/utilcode/utils/SizeUtils.java | 2 +- .../com/blankj/utilcode/utils/TimeUtils.java | 24 +- utilcode/utilcode.iml | 40 +-- 14 files changed, 282 insertions(+), 261 deletions(-) create mode 100644 utilcode/project.properties diff --git a/README.md b/README.md index 53c8f43f..463486c3 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ *** Gradle: ``` groovy -compile 'com.blankj:utilcode:1.0' +compile 'com.blankj:utilcode:1.1.0' ``` ### Proguard diff --git a/md/about_network.md b/md/about_network.md index 938d62a5..bf24a1f1 100644 --- a/md/about_network.md +++ b/md/about_network.md @@ -60,6 +60,9 @@ public class NetworkUtils { /** * 判断网络是否可用 *

需添加权限 android.permission.ACCESS_NETWORK_STATE

+ * + * @param context 上下文 + * @return true: 可用
false: 不可用 */ public static boolean isAvailable(Context context) { NetworkInfo info = getActiveNetworkInfo(context); diff --git a/md/about_shell.md b/md/about_shell.md index c0e22cf2..fb10b491 100644 --- a/md/about_shell.md +++ b/md/about_shell.md @@ -27,6 +27,7 @@ public class ShellUtils { /** * 判断设备是否root + * @return true: root
false: 没root */ public static boolean isRoot() { return execCmd("echo root", true, false).result == 0; diff --git a/md/about_size.md b/md/about_size.md index 246c71e5..3e162c94 100644 --- a/md/about_size.md +++ b/md/about_size.md @@ -102,7 +102,7 @@ public class SizeUtils { *
      * SizeUtils.forceGetViewSize(view);
      * SizeUtils.setListener(new SizeUtils.onGetSizeListener() {
-     *     
@Override + * @Override * public void onGetSize(View view) { * Log.d("tag", view.getWidth() + " " + view.getHeight()); * } diff --git a/md/about_time.md b/md/about_time.md index ce287b35..a19bb2c2 100644 --- a/md/about_time.md +++ b/md/about_time.md @@ -3,6 +3,9 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; + +import static com.blankj.utilcode.utils.ConstUtils.*; /** *
@@ -27,7 +30,7 @@ public class TimeUtils {
      * 

* 定义了以下模式字母(所有其他字符 'A' 到 'Z' 和 'a' 到 'z' 都被保留):
* - * + * * * * @@ -39,7 +42,7 @@ public class TimeUtils { * * * - * + * * * * @@ -51,7 +54,7 @@ public class TimeUtils { * * * - * + * * * * @@ -63,7 +66,7 @@ public class TimeUtils { * * * - * + * * * * @@ -75,7 +78,7 @@ public class TimeUtils { * * * - * + * * * * @@ -87,7 +90,7 @@ public class TimeUtils { * * * - * + * * * * @@ -99,7 +102,7 @@ public class TimeUtils { * * * - * + * * * * @@ -111,7 +114,7 @@ public class TimeUtils { * * * - * + * * * * @@ -123,7 +126,7 @@ public class TimeUtils { * * * - * + * * * * @@ -135,7 +138,7 @@ public class TimeUtils { * * * - * + * * * * @@ -149,27 +152,32 @@ public class TimeUtils { * *
字母日期或时间元素表示TextAD
y Year Month July; Jul; 07
w 年中的周数 Number Number 2
D 年中的天数 Number Number 10
F 月份中的星期 Number Text Tuesday; Tue
a Am/pm 标记 Text Number 0
k 一天中的小时数(1-24) Number Number 0
h am/pm 中的小时数(1-12) Number Number 30
s 分钟中的秒数 Number Number 978
z 时区 General time zone
*
-     *                     yyyy-MM-dd 1969-12-31
-     *                     yyyy-MM-dd 1970-01-01
-     *               yyyy-MM-dd HH:mm 1969-12-31 16:00
-     *               yyyy-MM-dd HH:mm 1970-01-01 00:00
-     *              yyyy-MM-dd HH:mmZ 1969-12-31 16:00-0800
-     *              yyyy-MM-dd HH:mmZ 1970-01-01 00:00+0000
-     *       yyyy-MM-dd HH:mm:ss.SSSZ 1969-12-31 16:00:00.000-0800
-     *       yyyy-MM-dd HH:mm:ss.SSSZ 1970-01-01 00:00:00.000+0000
-     *     yyyy-MM-dd'T'HH:mm:ss.SSSZ 1969-12-31T16:00:00.000-0800
-     *     yyyy-MM-dd'T'HH:mm:ss.SSSZ 1970-01-01T00:00:00.000+0000
+     *                          HH:mm    15:44
+     *                         h:mm a    3:44 下午
+     *                        HH:mm z    15:44 CST
+     *                        HH:mm Z    15:44 +0800
+     *                     HH:mm zzzz    15:44 中国标准时间
+     *                       HH:mm:ss    15:44:40
+     *                     yyyy-MM-dd    2016-08-12
+     *               yyyy-MM-dd HH:mm    2016-08-12 15:44
+     *            yyyy-MM-dd HH:mm:ss    2016-08-12 15:44:40
+     *       yyyy-MM-dd HH:mm:ss zzzz    2016-08-12 15:44:40 中国标准时间
+     *  EEEE yyyy-MM-dd HH:mm:ss zzzz    星期五 2016-08-12 15:44:40 中国标准时间
+     *       yyyy-MM-dd HH:mm:ss.SSSZ    2016-08-12 15:44:40.461+0800
+     *     yyyy-MM-dd'T'HH:mm:ss.SSSZ    2016-08-12T15:44:40.461+0800
+     *   yyyy.MM.dd G 'at' HH:mm:ss z    2016.08.12 公元 at 15:44:40 CST
+     *                         K:mm a    3:44 下午
+     *               EEE, MMM d, ''yy    星期五, 八月 12, '16
+     *          hh 'o''clock' a, zzzz    03 o'clock 下午, 中国标准时间
+     *   yyyyy.MMMMM.dd GGG hh:mm aaa    02016.八月.12 公元 03:44 下午
+     *     EEE, d MMM yyyy HH:mm:ss Z    星期五, 12 八月 2016 15:44:40 +0800
+     *                  yyMMddHHmmssZ    160812154440+0800
+     *     yyyy-MM-dd'T'HH:mm:ss.SSSZ    2016-08-12T15:44:40.461+0800
+     * EEEE 'DATE('yyyy-MM-dd')' 'TIME('HH:mm:ss')' zzzz    星期五 DATE(2016-08-12) TIME(15:44:40) 中国标准时间
      * 
*/ - public static final SimpleDateFormat DEFAULT_SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - /** - * 各时间单位与毫秒的倍数 - */ - public static final int UNIT_MSEC = 1; - public static final int UNIT_SEC = 1000; - public static final int UNIT_MIN = 60000; - public static final int UNIT_HOUR = 3600000; - public static final int UNIT_DAY = 86400000; + public static final SimpleDateFormat DEFAULT_SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); + /** * 将时间戳转为时间字符串 @@ -293,22 +301,22 @@ public class TimeUtils { * * @param milliseconds 毫秒时间戳 * @param unit * @return unit时间戳 */ private static long milliseconds2Unit(long milliseconds, int unit) { switch (unit) { - case UNIT_MSEC: - case UNIT_SEC: - case UNIT_MIN: - case UNIT_HOUR: - case UNIT_DAY: - return Math.abs(milliseconds) / unit; + case MSEC: + case SEC: + case MIN: + case HOUR: + case DAY: + return milliseconds / unit; } return -1; } @@ -317,59 +325,60 @@ public class TimeUtils { * 获取两个时间差(单位:unit) *

time1和time2格式都为yyyy-MM-dd HH:mm:ss

* - * @param time1 时间字符串1 - * @param time2 时间字符串2 + * @param time0 时间字符串1 + * @param time1 时间字符串2 * @param unit * @return unit时间戳 */ - public static long getIntervalTime(String time1, String time2, int unit) { - return getIntervalTime(time1, time2, unit, DEFAULT_SDF); + public static long getIntervalTime(String time0, String time1, int unit) { + return getIntervalTime(time0, time1, unit, DEFAULT_SDF); } /** * 获取两个时间差(单位:unit) *

time1和time2格式都为format

* - * @param time1 时间字符串1 - * @param time2 时间字符串2 + * @param time0 时间字符串1 + * @param time1 时间字符串2 * @param unit * @param format 时间格式 * @return unit时间戳 */ - public static long getIntervalTime(String time1, String time2, int unit, SimpleDateFormat format) { - return milliseconds2Unit(string2Milliseconds(time1, format) - - string2Milliseconds(time2, format), unit); + public static long getIntervalTime(String time0, String time1, int unit, SimpleDateFormat format) { + return Math.abs(milliseconds2Unit(string2Milliseconds(time0, format) + - string2Milliseconds(time1, format), unit)); } /** * 获取两个时间差(单位:unit) *

time1和time2都为Date类型

* - * @param time1 Date类型时间1 - * @param time2 Date类型时间2 + * @param time0 Date类型时间1 + * @param time1 Date类型时间2 * @param unit * @return unit时间戳 */ - public static long getIntervalTime(Date time1, Date time2, int unit) { - return milliseconds2Unit(date2Milliseconds(time2) - date2Milliseconds(time1), unit); + public static long getIntervalTime(Date time0, Date time1, int unit) { + return Math.abs(milliseconds2Unit(date2Milliseconds(time1) + - date2Milliseconds(time0), unit)); } /** @@ -388,7 +397,7 @@ public class TimeUtils { * @return 时间字符串 */ public static String getCurTimeString() { - return milliseconds2String(getCurTimeMills()); + return date2String(new Date()); } /** @@ -399,7 +408,7 @@ public class TimeUtils { * @return 时间字符串 */ public static String getCurTimeString(SimpleDateFormat format) { - return milliseconds2String(getCurTimeMills(), format); + return date2String(new Date(), format); } /** @@ -418,11 +427,11 @@ public class TimeUtils { * * @param time 时间字符串 * @param unit * @return unit时间戳 */ @@ -436,11 +445,11 @@ public class TimeUtils { * * @param time 时间字符串 * @param unit * @param format 时间格式 * @return unit时间戳 @@ -455,11 +464,11 @@ public class TimeUtils { * * @param time Date类型时间 * @param unit * @return unit时间戳 */ @@ -476,6 +485,5 @@ public class TimeUtils { public static boolean isLeapYear(int year) { return year % 4 == 0 && year % 100 != 0 || year % 400 == 0; } - } ``` \ No newline at end of file diff --git a/md/update_log.md b/md/update_log.md index 43f7376e..67f99689 100644 --- a/md/update_log.md +++ b/md/update_log.md @@ -1,5 +1,5 @@ ### 更新Log -#### 16/08/16 新增StringUtils及单元测试,完善正则工具类 +#### 16/08/16 新增StringUtils及单元测试,完善正则工具类,版本更新1.1.0 #### 16/08/15 新增3DES和AES加密及单元检测,加密解密工具类基本完善,目录更新 #### 16/08/14 新增DES加密及单元检测 #### 16/08/13 新增MD2,SHA224,SHA256,SHA384,SHA512加密及单元测试,正折腾DES加密 diff --git a/utilcode/build.gradle b/utilcode/build.gradle index e4266e8a..412748dc 100644 --- a/utilcode/build.gradle +++ b/utilcode/build.gradle @@ -1,7 +1,4 @@ apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' - -group = 'com.github.blankj' android { compileSdkVersion 23 @@ -25,4 +22,6 @@ dependencies { testCompile 'junit:junit:4.12' testCompile 'org.robolectric:robolectric:3.1.2' testCompile 'com.google.truth:truth:0.29' -} \ No newline at end of file +} +apply from: "https://raw.githubusercontent.com/xiaopansky/android-library-publish-to-jcenter/master/bintrayUpload.gradle" +// gradlew bintrayUpload \ No newline at end of file diff --git a/utilcode/project.properties b/utilcode/project.properties new file mode 100644 index 00000000..174f8432 --- /dev/null +++ b/utilcode/project.properties @@ -0,0 +1,10 @@ +#project +project.name=UtilCode +project.groupId=com.blankj +project.artifactId=utilcode +project.packaging=aar +project.siteUrl=https://github.com/Blankj/AndroidUtilCode +project.gitUrl=https://github.com/Blankj/AndroidUtilCode.git + +#javadoc +javadoc.name=UtilCode \ No newline at end of file diff --git a/utilcode/src/main/java/com/blankj/utilcode/utils/NetworkUtils.java b/utilcode/src/main/java/com/blankj/utilcode/utils/NetworkUtils.java index ec1b6cff..a3dc7212 100644 --- a/utilcode/src/main/java/com/blankj/utilcode/utils/NetworkUtils.java +++ b/utilcode/src/main/java/com/blankj/utilcode/utils/NetworkUtils.java @@ -60,6 +60,9 @@ public class NetworkUtils { /** * 判断网络是否可用 *

需添加权限 android.permission.ACCESS_NETWORK_STATE

+ * + * @param context 上下文 + * @return true: 可用
false: 不可用 */ public static boolean isAvailable(Context context) { NetworkInfo info = getActiveNetworkInfo(context); diff --git a/utilcode/src/main/java/com/blankj/utilcode/utils/SDCardUtils.java b/utilcode/src/main/java/com/blankj/utilcode/utils/SDCardUtils.java index 652e55df..ebab18f0 100644 --- a/utilcode/src/main/java/com/blankj/utilcode/utils/SDCardUtils.java +++ b/utilcode/src/main/java/com/blankj/utilcode/utils/SDCardUtils.java @@ -1,12 +1,8 @@ package com.blankj.utilcode.utils; import android.os.Environment; -import android.os.StatFs; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; /** *
@@ -41,136 +37,134 @@ public class SDCardUtils {
         return Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator;
     }
 
-    /**
-     * 获取SD卡的剩余容量 单位byte
-     *
-     * @return
-     */
-    public static long getSDCardAllSize() {
-        if (isSDCardEnable()) {
-            StatFs stat = new StatFs(getSDCardPath());
-            // 获取空闲的数据块的数量
-            long availableBlocks = (long) stat.getAvailableBlocks() - 4;
-            // 获取单个数据块的大小(byte)
-            long freeBlocks = stat.getAvailableBlocks();
-            return freeBlocks * availableBlocks;
-        }
-        return 0;
-    }
-
-    /**
-     * 获取指定路径所在空间的剩余可用容量字节数,单位byte
-     *
-     * @param filePath
-     * @return 容量字节 SDCard可用空间,内部存储可用空间
-     */
-    public static long getFreeBytes(String filePath) {
-        // 如果是sd卡的下的路径,则获取sd卡可用容量
-        if (filePath.startsWith(getSDCardPath())) {
-            filePath = getSDCardPath();
-        } else {// 如果是内部存储的路径,则获取内存存储的可用容量
-            filePath = Environment.getDataDirectory().getAbsolutePath();
-        }
-        StatFs stat = new StatFs(filePath);
-        long availableBlocks = (long) stat.getAvailableBlocks() - 4;
-        return stat.getBlockSize() * availableBlocks;
-    }
-
-    /**
-     * 获取系统存储路径
-     *
-     * @return
-     */
-    public static String getRootDirectoryPath() {
-        return Environment.getRootDirectory().getAbsolutePath();
-    }
-
-    /**
-     * Check if the file is exists
-     *
-     * @param filePath
-     * @param fileName
-     * @return
-     */
-    public static boolean isFileExistsInSDCard(String filePath, String fileName) {
-        boolean flag = false;
-        if (isSDCardEnable()) {
-            File file = new File(filePath, fileName);
-            if (file.exists()) {
-                flag = true;
-            }
-        }
-        return flag;
-    }
-
-    /**
-     * Write file to SD card
-     * @param filePath
-     * @param filename
-     * @param content
-     * @return
-     * @throws Exception
-     */
-    public static boolean saveFileToSDCard(String filePath, String filename, String content)
-            throws Exception {
-        boolean flag = false;
-        if (isSDCardEnable()) {
-            File dir = new File(filePath);
-            if (!dir.exists()) {
-                dir.mkdir();
-            }
-            File file = new File(filePath, filename);
-            FileOutputStream outStream = new FileOutputStream(file);
-            outStream.write(content.getBytes());
-            outStream.close();
-            flag = true;
-        }
-        return flag;
-    }
-
-    /**
-     * Read file as stream from SD card
-     *
-     * @param fileName
-     *            String PATH =
-     *            Environment.getExternalStorageDirectory().getAbsolutePath() +
-     *            "/dirName";
-     * @return
-     */
-    public static byte[] readFileFromSDCard(String filePath, String fileName) {
-        byte[] buffer = null;
-        FileInputStream fin = null;
-        try {
-            if (isSDCardEnable()) {
-                String filePaht = filePath + "/" + fileName;
-                fin = new FileInputStream(filePaht);
-                int length = fin.available();
-                buffer = new byte[length];
-                fin.read(buffer);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (fin != null) fin.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        return buffer;
-    }
-
-    /**
-     * Delete file
-     *
-     * @param filePath
-     * @param fileName
-     *            filePath =
-     *            android.os.Environment.getExternalStorageDirectory().getPath()
-     * @return
-     */
-    public static boolean deleteSDFile(String filePath, String fileName) {
-        File file = new File(filePath + "/" + fileName);
-        return !(!file.exists() || file.isDirectory()) && file.delete();
-    }
+//    /**
+//     * 获取SD卡的剩余容量 单位byte
+//     *
+//     * @return
+//     */
+//    public static long getSDCardAllSize() {
+//        if (isSDCardEnable()) {
+//            StatFs stat = new StatFs(getSDCardPath());
+//            // 获取空闲的数据块的数量
+//            long availableBlocks = (long) stat.getAvailableBlocks() - 4;
+//            // 获取单个数据块的大小(byte)
+//            long freeBlocks = stat.getAvailableBlocks();
+//            return freeBlocks * availableBlocks;
+//        }
+//        return 0;
+//    }
+//
+//    /**
+//     * 获取指定路径所在空间的剩余可用容量字节数,单位byte
+//     *
+//     * @param filePath
+//     * @return 容量字节 SDCard可用空间,内部存储可用空间
+//     */
+//    public static long getFreeBytes(String filePath) {
+//        // 如果是sd卡的下的路径,则获取sd卡可用容量
+//        if (filePath.startsWith(getSDCardPath())) {
+//            filePath = getSDCardPath();
+//        } else {// 如果是内部存储的路径,则获取内存存储的可用容量
+//            filePath = Environment.getDataDirectory().getAbsolutePath();
+//        }
+//        StatFs stat = new StatFs(filePath);
+//        long availableBlocks = (long) stat.getAvailableBlocks() - 4;
+//        return stat.getBlockSize() * availableBlocks;
+//    }
+//
+//    /**
+//     * 获取系统存储路径
+//     *
+//     * @return
+//     */
+//    public static String getRootDirectoryPath() {
+//        return Environment.getRootDirectory().getAbsolutePath();
+//    }
+//
+//    /**
+//     * Check if the file is exists
+//     *
+//     * @param filePath
+//     * @param fileName
+//     * @return
+//     */
+//    public static boolean isFileExistsInSDCard(String filePath, String fileName) {
+//        boolean flag = false;
+//        if (isSDCardEnable()) {
+//            File file = new File(filePath, fileName);
+//            if (file.exists()) {
+//                flag = true;
+//            }
+//        }
+//        return flag;
+//    }
+//
+//    /**
+//     * Write file to SD card
+//     *
+//     * @param filePath
+//     * @param filename
+//     * @param content
+//     * @return
+//     * @throws Exception
+//     */
+//    public static boolean saveFileToSDCard(String filePath, String filename, String content)
+//            throws Exception {
+//        boolean flag = false;
+//        if (isSDCardEnable()) {
+//            File dir = new File(filePath);
+//            if (!dir.exists()) {
+//                dir.mkdir();
+//            }
+//            File file = new File(filePath, filename);
+//            FileOutputStream outStream = new FileOutputStream(file);
+//            outStream.write(content.getBytes());
+//            outStream.close();
+//            flag = true;
+//        }
+//        return flag;
+//    }
+//
+//    /**
+//     * Read file as stream from SD card
+//     *
+//     * @param fileName String PATH =
+//     *                 Environment.getExternalStorageDirectory().getAbsolutePath() +
+//     *                 "/dirName";
+//     * @return
+//     */
+//    public static byte[] readFileFromSDCard(String filePath, String fileName) {
+//        byte[] buffer = null;
+//        FileInputStream fin = null;
+//        try {
+//            if (isSDCardEnable()) {
+//                String filePaht = filePath + "/" + fileName;
+//                fin = new FileInputStream(filePaht);
+//                int length = fin.available();
+//                buffer = new byte[length];
+//                fin.read(buffer);
+//            }
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        } finally {
+//            try {
+//                if (fin != null) fin.close();
+//            } catch (IOException e) {
+//                e.printStackTrace();
+//            }
+//        }
+//        return buffer;
+//    }
+//
+//    /**
+//     * Delete file
+//     *
+//     * @param filePath 文件路径
+//     * @param fileName 文件名
+//     * @return true: 成功
false: 失败 +// */ +// public static boolean deleteSDFile(String filePath, String fileName) { +// File file = new File(filePath + "/" + fileName); +// return !(!file.exists() || file.isDirectory()) && file.delete(); +// } } \ No newline at end of file diff --git a/utilcode/src/main/java/com/blankj/utilcode/utils/ShellUtils.java b/utilcode/src/main/java/com/blankj/utilcode/utils/ShellUtils.java index 0a756c03..4df63f5e 100644 --- a/utilcode/src/main/java/com/blankj/utilcode/utils/ShellUtils.java +++ b/utilcode/src/main/java/com/blankj/utilcode/utils/ShellUtils.java @@ -27,6 +27,7 @@ public class ShellUtils { /** * 判断设备是否root + * @return true: root
false: 没root */ public static boolean isRoot() { return execCmd("echo root", true, false).result == 0; diff --git a/utilcode/src/main/java/com/blankj/utilcode/utils/SizeUtils.java b/utilcode/src/main/java/com/blankj/utilcode/utils/SizeUtils.java index 076e78a4..0f2620d5 100644 --- a/utilcode/src/main/java/com/blankj/utilcode/utils/SizeUtils.java +++ b/utilcode/src/main/java/com/blankj/utilcode/utils/SizeUtils.java @@ -102,7 +102,7 @@ public class SizeUtils { *
      * SizeUtils.forceGetViewSize(view);
      * SizeUtils.setListener(new SizeUtils.onGetSizeListener() {
-     *     @Override
+     *     @Override
      *     public void onGetSize(View view) {
      *         Log.d("tag", view.getWidth() + " " + view.getHeight());
      *     }
diff --git a/utilcode/src/main/java/com/blankj/utilcode/utils/TimeUtils.java b/utilcode/src/main/java/com/blankj/utilcode/utils/TimeUtils.java
index d612ff43..23e9fa91 100644
--- a/utilcode/src/main/java/com/blankj/utilcode/utils/TimeUtils.java
+++ b/utilcode/src/main/java/com/blankj/utilcode/utils/TimeUtils.java
@@ -30,7 +30,7 @@ public class TimeUtils {
      * 

* 定义了以下模式字母(所有其他字符 'A' 到 'Z' 和 'a' 到 'z' 都被保留):
* - * + * * * * @@ -42,7 +42,7 @@ public class TimeUtils { * * * - * + * * * * @@ -54,7 +54,7 @@ public class TimeUtils { * * * - * + * * * * @@ -66,7 +66,7 @@ public class TimeUtils { * * * - * + * * * * @@ -78,7 +78,7 @@ public class TimeUtils { * * * - * + * * * * @@ -90,7 +90,7 @@ public class TimeUtils { * * * - * + * * * * @@ -102,7 +102,7 @@ public class TimeUtils { * * * - * + * * * * @@ -114,7 +114,7 @@ public class TimeUtils { * * * - * + * * * * @@ -126,7 +126,7 @@ public class TimeUtils { * * * - * + * * * * @@ -138,7 +138,7 @@ public class TimeUtils { * * * - * + * * * * @@ -485,6 +485,4 @@ public class TimeUtils { public static boolean isLeapYear(int year) { return year % 4 == 0 && year % 100 != 0 || year % 400 == 0; } - -} - +} \ No newline at end of file diff --git a/utilcode/utilcode.iml b/utilcode/utilcode.iml index ceedc0ed..79a744d8 100644 --- a/utilcode/utilcode.iml +++ b/utilcode/utilcode.iml @@ -65,14 +65,6 @@ - - - - - - - - @@ -81,6 +73,16 @@ + + + + + + + + + + @@ -88,8 +90,10 @@ + + @@ -103,15 +107,15 @@ - + - - - + + + @@ -120,29 +124,29 @@ - + - + - - + - + - + + \ No newline at end of file -- GitLab
字母日期或时间元素表示TextAD
y Year Month July; Jul; 07
w 年中的周数 Number Number 2
D 年中的天数 Number Number 10
F 月份中的星期 Number Text Tuesday; Tue
a Am/pm 标记 Text Number 0
k 一天中的小时数(1-24) Number Number 0
h am/pm 中的小时数(1-12) Number Number 30
s 分钟中的秒数 Number Number 978
z 时区 General time zone