Seth Hikari
Seth Hikari

Reputation: 2771

Convert a user inputted time to UNIX Time? [Android]

How would I convert a user given time, using the time picker would be fine, into UNIX time assuming the user inputted a time in the same time zone that they are currently in?

Upvotes: 0

Views: 674

Answers (1)

LambergaR
LambergaR

Reputation: 2473

You should use Calendar to convert values provided by the user to valid Unix timestamps

Calendar cal = Calendar.getInstance();
cal.set(2011, 9, 3);
cal.getTimeInMillis();

Upvotes: 1

Related Questions