The java.util.Date
class store time internally in a format very close to the POSIX time format (it uses milliseconds instead of seconds). So assuming you have your date in a String
object called stringDate
:
SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
long dateInMilli = dateParser.parse(stringDate).getTime();
long posixDate = dateInMilli/1000