File tree 2 files changed +56
-0
lines changed
content/java/concepts/calendar/terms/getActualMinimum
2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ Title : ' .getActualMinimum()'
3
+ Description : ' Returns the minimum value allowed for a given calendar field.'
4
+ Subjects :
5
+ - ' Code Foundations'
6
+ - ' Computer Science'
7
+ Tags :
8
+ - ' Calendar'
9
+ - ' Time'
10
+ - ' Date'
11
+ CatalogContent :
12
+ - ' learn-java'
13
+ - ' paths/computer-science'
14
+ ---
15
+
16
+ The ** ` .getActualMinimum() ` ** method returns the minimum value allowed for a given calendar field.
17
+
18
+ ## Syntax
19
+
20
+ ``` pseudo
21
+ min = cal.getActualMinimum(field);
22
+ ```
23
+
24
+ Where ` myCalendar ` is a ` Calendar ` object, and ` field ` is the constant for which the minimum will be returned.
25
+
26
+ ## Example
27
+
28
+ The below example uses ` .getActualMinimum() ` to retrieve the minimum value for a year and the minimum value for a month.
29
+
30
+ ``` java
31
+ import java.util.Calendar ;
32
+
33
+ public class CalendarDemo {
34
+ public static void main (String [] args ) {
35
+
36
+ // Create a calendar
37
+ Calendar cal = Calendar . getInstance();
38
+
39
+ // Return the minimum value that the year field could have
40
+ int a = cal. getActualMinimum(Calendar . YEAR );
41
+ System . out. println(" Minimum year: " + a);
42
+
43
+ // Return the minimum value that the month field could have
44
+ int i = cal. getActualMinimum(Calendar . MONTH );
45
+ System . out. println(" Minimum month: " + i);
46
+ }
47
+ }
48
+ ```
49
+
50
+ The output from the snippet above would look like this:
51
+
52
+ ``` shell
53
+ Minimum year: 1
54
+ Minimum month: 0
55
+ ```
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ Browser Compatibility
47
47
Browsers
48
48
Bubble Sort
49
49
Buttons
50
+ Calendar
50
51
Catch
51
52
Characters
52
53
Chatbots
You can’t perform that action at this time.
0 commit comments