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() }