The code below shows the text of a parsed Date
object, and the static field Calendar.MINUTE
. Can someone inform why they're different?
The docs say it's supposed to get the current minute value as an int.
EDIT: image removed, code/result updated.
public class Testerson {
public void print()
{
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm");
System.out.println("Date time = " + sdf.format(new Date()));
System.out.println("Calendar Minute = " + Calendar.MINUTE);
}
public static void main(String[] args) throws ParseException
{
Testerson test = new Testerson();
test.print();
}
}
With an output of;
Date time = 08/04/2018 05:49
Calendar Minute = 12