SimpleDateFormat sdf1 = new SimpleDateFormat(yyyy-MM-dd kk:mm:ss); SimpleDateFormat sdf2 = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss); Calendar cal = Calendar.getInstance(); Date d = cal.getTime(); System.out.println("Current Time is:"+d); System.out.println("Time value using kk:" + sdf1.format(d)); System.out.println("Time Value using HH:" + sdf2.format(d)); Result: Current Time is: Wed Sep 25 00:55:20 IST 2013 Time value using kk : 2013-09-25 24:55:20 Time value using HH : 2013-09-25 00:55:20
Can someone tell me why this behavior changes over time when kk and HH are used.
as well as kk gives 24:55:20, this is useful anywhere. As far as I know, there is only 00:00:00 to 23:59:59 - this is a time range.
Are there any outside this range, if so, where is the place “kk” useful?
Mohan source share