Search This Blog

Friday, November 15, 2013

Android Java - Convert day year month hour minute second to miliseconds since epoch / convert to java.util.Date

public Date getDate()
{
    final Calendar cal = Calendar.getInstance();
    cal.set(2013, 12 - 1, 7, 17, 33, 01);
    long secondsSinceEpoch = cal.getTimeInMillis();
    Date date = new Date();
    date.setTime(secondsSinceEpoch);
    return date;
}

No comments:

Post a Comment

If you like this post, please leave a comment :)