001 /* 002 * Copyright 2001-2005 Stephen Colebourne 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.joda.time; 017 018 /** 019 * DateTimeConstants is a non-instantiable class of constants used in 020 * the date time system. These are the ISO8601 constants, but should be 021 * used by all chronologies. 022 * <p> 023 * DateTimeConstants is thread-safe and immutable. 024 * 025 * @author Stephen Colebourne 026 * @author Brian S O'Neill 027 * @since 1.0 028 */ 029 public class DateTimeConstants { 030 031 // These are ints not enumerations as they represent genuine int values 032 /** Constant (1) representing January, the first month (ISO) */ 033 public static final int JANUARY = 1; 034 035 /** Constant (2) representing February, the second month (ISO) */ 036 public static final int FEBRUARY = 2; 037 038 /** Constant (3) representing March, the third month (ISO) */ 039 public static final int MARCH = 3; 040 041 /** Constant (4) representing April, the fourth month (ISO) */ 042 public static final int APRIL = 4; 043 044 /** Constant (5) representing May, the fifth month (ISO) */ 045 public static final int MAY = 5; 046 047 /** Constant (6) representing June, the sixth month (ISO) */ 048 public static final int JUNE = 6; 049 050 /** Constant (7) representing July, the seventh month (ISO) */ 051 public static final int JULY = 7; 052 053 /** Constant (8) representing August, the eighth month (ISO) */ 054 public static final int AUGUST = 8; 055 056 /** Constant (9) representing September, the nineth month (ISO) */ 057 public static final int SEPTEMBER = 9; 058 059 /** Constant (10) representing October, the tenth month (ISO) */ 060 public static final int OCTOBER = 10; 061 062 /** Constant (11) representing November, the eleventh month (ISO) */ 063 public static final int NOVEMBER = 11; 064 065 /** Constant (12) representing December, the twelfth month (ISO) */ 066 public static final int DECEMBER = 12; 067 068 // These are ints not enumerations as they represent genuine int values 069 /** Constant (1) representing Monday, the first day of the week (ISO) */ 070 public static final int MONDAY = 1; 071 072 /** Constant (2) representing Tuesday, the second day of the week (ISO) */ 073 public static final int TUESDAY = 2; 074 075 /** Constant (3) representing Wednesday, the third day of the week (ISO) */ 076 public static final int WEDNESDAY = 3; 077 078 /** Constant (4) representing Thursday, the fourth day of the week (ISO) */ 079 public static final int THURSDAY = 4; 080 081 /** Constant (5) representing Friday, the fifth day of the week (ISO) */ 082 public static final int FRIDAY = 5; 083 084 /** Constant (6) representing Saturday, the sixth day of the week (ISO) */ 085 public static final int SATURDAY = 6; 086 087 /** Constant (7) representing Sunday, the seventh day of the week (ISO) */ 088 public static final int SUNDAY = 7; 089 090 091 /** Constant (0) representing AM, the morning (from Calendar) */ 092 public static final int AM = 0; 093 094 /** Constant (1) representing PM, the afternoon (from Calendar) */ 095 public static final int PM = 1; 096 097 098 /** Constant (0) representing BC, years before zero (from Calendar) */ 099 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 }