1 | /* |
2 | * Copyright 2001-2005 Stephen Colebourne |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | */ |
16 | package org.joda.time; |
17 | |
18 | /** |
19 | * DateTimeConstants is a non-instantiable class of constants used in |
20 | * the date time system. These are the ISO8601 constants, but should be |
21 | * used by all chronologies. |
22 | * <p> |
23 | * DateTimeConstants is thread-safe and immutable. |
24 | * |
25 | * @author Stephen Colebourne |
26 | * @author Brian S O'Neill |
27 | * @since 1.0 |
28 | */ |
29 | public class DateTimeConstants { |
30 | |
31 | // These are ints not enumerations as they represent genuine int values |
32 | /** Constant (1) representing January, the first month (ISO) */ |
33 | public static final int JANUARY = 1; |
34 | |
35 | /** Constant (2) representing February, the second month (ISO) */ |
36 | public static final int FEBRUARY = 2; |
37 | |
38 | /** Constant (3) representing March, the third month (ISO) */ |
39 | public static final int MARCH = 3; |
40 | |
41 | /** Constant (4) representing April, the fourth month (ISO) */ |
42 | public static final int APRIL = 4; |
43 | |
44 | /** Constant (5) representing May, the fifth month (ISO) */ |
45 | public static final int MAY = 5; |
46 | |
47 | /** Constant (6) representing June, the sixth month (ISO) */ |
48 | public static final int JUNE = 6; |
49 | |
50 | /** Constant (7) representing July, the seventh month (ISO) */ |
51 | public static final int JULY = 7; |
52 | |
53 | /** Constant (8) representing August, the eighth month (ISO) */ |
54 | public static final int AUGUST = 8; |
55 | |
56 | /** Constant (9) representing September, the nineth month (ISO) */ |
57 | public static final int SEPTEMBER = 9; |
58 | |
59 | /** Constant (10) representing October, the tenth month (ISO) */ |
60 | public static final int OCTOBER = 10; |
61 | |
62 | /** Constant (11) representing November, the eleventh month (ISO) */ |
63 | public static final int NOVEMBER = 11; |
64 | |
65 | /** Constant (12) representing December, the twelfth month (ISO) */ |
66 | public static final int DECEMBER = 12; |
67 | |
68 | // These are ints not enumerations as they represent genuine int values |
69 | /** Constant (1) representing Monday, the first day of the week (ISO) */ |
70 | public static final int MONDAY = 1; |
71 | |
72 | /** Constant (2) representing Tuesday, the second day of the week (ISO) */ |
73 | public static final int TUESDAY = 2; |
74 | |
75 | /** Constant (3) representing Wednesday, the third day of the week (ISO) */ |
76 | public static final int WEDNESDAY = 3; |
77 | |
78 | /** Constant (4) representing Thursday, the fourth day of the week (ISO) */ |
79 | public static final int THURSDAY = 4; |
80 | |
81 | /** Constant (5) representing Friday, the fifth day of the week (ISO) */ |
82 | public static final int FRIDAY = 5; |
83 | |
84 | /** Constant (6) representing Saturday, the sixth day of the week (ISO) */ |
85 | public static final int SATURDAY = 6; |
86 | |
87 | /** Constant (7) representing Sunday, the seventh day of the week (ISO) */ |
88 | public static final int SUNDAY = 7; |
89 | |
90 | |
91 | /** Constant (0) representing AM, the morning (from Calendar) */ |
92 | public static final int AM = 0; |
93 | |
94 | /** Constant (1) representing PM, the afternoon (from Calendar) */ |
95 | public static final int PM = 1; |
96 | |
97 | |
98 | /** Constant (0) representing BC, years before zero (from Calendar) */ |
99 | public static final int BC = 0; |
100 | /** Alternative constant (0) representing BCE, Before Common Era (secular) */ |
101 | public static final int BCE = 0; |
102 | |
103 | /** |
104 | * Constant (1) representing AD, years after zero (from Calendar). |
105 | * <p> |
106 | * All new chronologies with differrent Era values should try to assign |
107 | * eras as follows. The era that was in force at 1970-01-01 (ISO) is assigned |
108 | * the value 1. Earlier eras are assigned sequentially smaller numbers. |
109 | * Later eras are assigned sequentially greater numbers. |
110 | */ |
111 | public static final int AD = 1; |
112 | /** |
113 | * Alternative constant (1) representing CE, Common Era (secular). |
114 | * <p> |
115 | * All new chronologies with differrent Era values should try to assign |
116 | * eras as follows. The era that was in force at 1970-01-01 (ISO) is assigned |
117 | * the value 1. Earlier eras are assigned sequentially smaller numbers. |
118 | * Later eras are assigned sequentially greater numbers. |
119 | */ |
120 | public static final int CE = 1; |
121 | |
122 | |
123 | /** Milliseconds in one second (1000) (ISO) */ |
124 | public static final int MILLIS_PER_SECOND = 1000; |
125 | |
126 | /** Seconds in one minute (60) (ISO) */ |
127 | public static final int SECONDS_PER_MINUTE = 60; |
128 | /** Milliseconds in one minute (ISO) */ |
129 | public static final int MILLIS_PER_MINUTE = MILLIS_PER_SECOND * SECONDS_PER_MINUTE; |
130 | |
131 | /** Minutes in one hour (ISO) */ |
132 | public static final int MINUTES_PER_HOUR = 60; |
133 | /** Seconds in one hour (ISO) */ |
134 | public static final int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR; |
135 | /** Milliseconds in one hour (ISO) */ |
136 | public static final int MILLIS_PER_HOUR = MILLIS_PER_MINUTE * MINUTES_PER_HOUR; |
137 | |
138 | /** Hours in a typical day (24) (ISO). Due to time zone offset changes, the |
139 | * number of hours per day can vary. */ |
140 | public static final int HOURS_PER_DAY = 24; |
141 | /** Minutes in a typical day (ISO). Due to time zone offset changes, the number |
142 | * of minutes per day can vary. */ |
143 | public static final int MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY; |
144 | /** Seconds in a typical day (ISO). Due to time zone offset changes, the number |
145 | * of seconds per day can vary. */ |
146 | public static final int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY; |
147 | /** Milliseconds in a typical day (ISO). Due to time zone offset changes, the |
148 | * number of milliseconds per day can vary. */ |
149 | public static final int MILLIS_PER_DAY = MILLIS_PER_HOUR * HOURS_PER_DAY; |
150 | |
151 | /** Days in one week (7) (ISO) */ |
152 | public static final int DAYS_PER_WEEK = 7; |
153 | /** Hours in a typical week. Due to time zone offset changes, the number of |
154 | * hours per week can vary. */ |
155 | public static final int HOURS_PER_WEEK = HOURS_PER_DAY * DAYS_PER_WEEK; |
156 | /** Minutes in a typical week (ISO). Due to time zone offset changes, the number |
157 | * of minutes per week can vary. */ |
158 | public static final int MINUTES_PER_WEEK = MINUTES_PER_DAY * DAYS_PER_WEEK; |
159 | /** Seconds in a typical week (ISO). Due to time zone offset changes, the number |
160 | * of seconds per week can vary. */ |
161 | public static final int SECONDS_PER_WEEK = SECONDS_PER_DAY * DAYS_PER_WEEK; |
162 | /** Milliseconds in a typical week (ISO). Due to time zone offset changes, the |
163 | * number of milliseconds per week can vary. */ |
164 | public static final int MILLIS_PER_WEEK = MILLIS_PER_DAY * DAYS_PER_WEEK; |
165 | |
166 | /** |
167 | * Restrictive constructor |
168 | */ |
169 | protected DateTimeConstants() { |
170 | } |
171 | |
172 | } |