【发布时间】:2020-10-24 19:11:37
【问题描述】:
我正在开发一个 Android 应用程序,它允许用户为计时器功能设置日期和时间。 我想以秒为单位将设置的日期和时间数据存储到单行时间戳中。 示例:
String datetime = Integer.toString(mDay) + Integer.toString(mMonth) + Integer.toString(mYear) + Integer.toString(mHour) + Integer.toString(mMinute);
日期时间的值为 11720202330 (11/7/2020 23:30) 我想将它存储为 s 中的时间戳值,即 Epoch 时间戳中的 1594510200。 谢谢。
【问题讨论】:
-
您的日期时间
String的格式非常不合适... -
如果将 7 月 11 日指定为 11720202330(例如),那么 12 月 1 日将如何指定?我们可以将它与 2 月 11 日区别开来吗?那是字符串还是整数?
标签: java android android-studio datetime timestamp