我正在让用户输入日期和时间。我需要将其更改为int以适合sqlight DB。我尝试将其解析为字符串,然后解析为int,但这行不通吗?
Time newTime= new Time();
newTime.hour=fmtTime.HOUR0_FIELD;
newTime.minute=fmtTime.MINUTE_FIELD;
newTime.monthDay=fmtDate.DAY_OF_WEEK_IN_MONTH_FIELD;
newTime.month=fmtDate.MONTH_FIELD;
newTime.year=fmtDate.YEAR_FIELD;
int currentTime=newTime.get;//how would I convert newTime to an int?
最佳答案
currentTime = (int) (newTime.toMillis() / 1000L);