简体   繁体   中英

Java Time/Date format

Simple question it's night here and I don't want to wait till morning

At 6AM:

SimpleDateFormat sdf = new SimpleDateFormat("HH");

Will sdf be 06, or just 6

Thanks.

It will be 06, not 6.

have a look at this if you need more help on the date/time format

http://www.tutorialspoint.com/java/java_date_time.htm

Hope this helps!

You can use this SimpleDateFormat sdf; sdf = new SimpleDateFormat("hh:mm:ss"); and use 06 instead of 6

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