From 433fa3cba41827f18c3c8c4db402deaa14adfe0b Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 11 Oct 2019 22:12:09 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/utils/TimeUtils.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/utils/TimeUtils.kt b/app/src/main/java/io/legado/app/utils/TimeUtils.kt index d350fd0c3..456892361 100644 --- a/app/src/main/java/io/legado/app/utils/TimeUtils.kt +++ b/app/src/main/java/io/legado/app/utils/TimeUtils.kt @@ -1,10 +1,23 @@ package io.legado.app.utils +import android.annotation.SuppressLint +import java.text.SimpleDateFormat + object TimeUtils { - fun stringTimeToLong(time: String): Long { + private val formatArray = arrayOf("") + @SuppressLint("SimpleDateFormat") + fun stringTimeToLong(time: String): Long { + for (str in formatArray) { + try { + val df = SimpleDateFormat(str) + val d = df.parse(time) + return d.time + } catch (e: Exception) { + } + } return System.currentTimeMillis() }