Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert Time to Long?

Tags:

java

android

time

For ex., I have the following value:

Time.valueOf("2:00:00")

how should I convert it to Long? (to be stored in SQLite database as Real)

java.sql.Time is used.

like image 512
LA_ Avatar asked Dec 03 '22 08:12

LA_


1 Answers

Use getTime():

Time t = Time.valueOf("2:00:00");
long l = t.getTime();
like image 168
MByD Avatar answered Dec 05 '22 20:12

MByD