简体   繁体   中英

Converting System.currentTimeMillis() into the current, readable time

Hey - is there a way to use the System.currentTimeMillis(); to have convery that number into a basic output HH:MM in droid?

I am using the sample code:

    Toast.makeText(this,
            String.valueOf(System.currentTimeMillis()),
            Toast.LENGTH_LONG).show();

That outputs the current time in MS since the epoch. There has got to be a better way to do this rather than convert that large number and display the current time right?

SimpleDateFormat timingFormat = new SimpleDateFormat("hh:mm");
timingFormat.format(new Date());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM