Last active
January 1, 2016 12:49
-
-
Save tushroy/8147154 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int day = datePicker.getDayOfMonth(); | |
int month = datePicker.getMonth() + 1; //plus 1 for making correct format | |
int year = datePicker.getYear(); | |
long unixtime; | |
String date = ""+day+month+year; //making String for SimpleDateFormat | |
DateFormat dfm = new SimpleDateFormat("ddMMyyyy"); // instantiate SimpleDateFormat | |
try{ | |
unixtime = dfm.parse(date).getTime(); //getting timestamp in milis | |
unixtime=unixtime/1000L; // getting timestamp in unix time | |
} | |
catch (ParseException e){ | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment