jcx.servlet.common
Class calendarServlet
jcx.servlet.Servlet
|
+--jcx.servlet.common.htmlServlet
|
+--jcx.servlet.common.multiStepServlet
|
+--jcx.servlet.common.calendarServlet
- Direct Known Subclasses:
- calendarServletInstance
- public abstract class calendarServlet
- extends multiStepServlet
行事曆的顯示,向前、向後,年月日時的行事記錄管理,
可繼承此類別另行開發功能更強的行事曆。
Field Summary |
protected static int |
formatDate
formatDate
if formatDate=1 then 日期格式為:YEARMONTHDAY ex:20000908
else if formatDate=2 then 日期格式為:YEAR/MONTH/DAY ex:2000/09/08
else if formatDate=3 then 日期格式為:MONTH/DAY/YEAR ex:09/08/2000
else if formatDate=4 then 日期格式為:YEAR.MONTH.DAY ex:2000.09.08
else if formatDate=5 then 日期格式為:MONTH.DAY.YEAR ex:09.08.2000
else if formatDate=6 then 日期格式為:MONTH DAY,YEAR ex:Sep 08,2000
else if formatDate=7 then 日期格式為:YEAR年MONTH月DAY日 ex:2000年09月08日
else if formatDate=8 then 日期格式為:YEAR年MONTH月DAY日 ex:二000年九月八日
else formatDate=1 then 日期格式為:YEARMONTHDAY ex:20000908
|
protected static int |
monthType
monthType
if monthType=1 then 月份的形式:數字(EX:01) //一月
else if monthType=2 then 月份的形式:中文(Ex:一)
else if monthType=3 then 月份的形式:英文(Ex:Jan)
else monthType=1 then 月份的形式:數字(EX:01)
|
protected static int |
weekType
weekType
if weekType=1 then 星期的形式:數字(EX:02) //星期一
else if weekType=2 then 星期的形式:中文(Ex:一)
else if weekType=3 then 星期的形式:英文(Ex:Mon)
else weekType=1 then 星期的形式:數字(EX:02)
其中數字形式時(weekType=1),
星期日=01,星期一=02、、、星期六=07
weekType=2
星期日=日,星期一=一、、、星期六=六
weekType=3
星期日=Sun,星期一=Mon、、、星期六=Sat
|
protected static int |
yearType
yearType
if yearType=1 then 年度的形式:數字(EX:1998) //西元1998年
else if yearType=2 then 年度的形式:中文(Ex:一九九八)
else yearType=1 then 年度的形式:數字(EX:1998)
|
Method Summary |
static java.lang.String |
CalculateDate(java.lang.String date,
int amount)
Function name:
CalculateDate(String,int)
傳入參數:
String date:日期(西元年月日 Ex:20001001)
int amount:傳回與date相距amount天的日期
回傳參數:
String:日期
程式功能:
取得與date相距amount天的日期
Ex:
String date="20001003";
if amount=-2 then return "20001001";
if amount=2 then return "20001005";
回傳日期的形式依 formatDate 的value而定 |
static int |
CalculateDays(java.lang.String date1,
java.lang.String date2)
Function name:
CalculateDays(String,String)
傳入參數:
String date1:日期(西元年月日 Ex:20001003)
String date2:日期(西元年月日 Ex:20001001)
回傳參數:
int:date1 與 date2相距的天數(date1-date2)
程式功能:
取得date1 與 date2相距的天數
Ex:
String date1="20001003";
if date2="20001001" then return 2;
if date2="20001005" then return -2;
|
static java.lang.String |
formatedTime(java.lang.String time,
java.lang.String time_type)
將傳入的 time 格式化,格式化的格式:
time_type="w" :time表示為星期日(=1)∼星期六(=7)中的一天。
|
static java.lang.String[][] |
getCalender()
Function name:
getCalendar()
傳入參數:
不需傳入參數
回傳參數:
String[][]:年、月、日和星期
程式功能:
取得當年月的月曆
String str[][]=new String[i][2];
str[0][0]:年度
str[0][1]:月份
if i>0 then str[i][0]:日
str[i][1]:星期(星期日==1,...,星期六==7)
return str;
str中的年、月、星期的形式依yearType,monthType,weekType的value而定 |
static java.lang.String[][] |
getCalender(int amount)
Function name:
getCalendar(int)
傳入參數:
int amount:傳回距當月amount月的月曆
Ex1:amount=-2 則傳回上上個月的月曆
若當月為2000年10月,則傳回2000年8月的月曆
Ex2:amount=2 則傳回下下個月的月曆
若當月為2000年10月,則傳回2000年12月的月曆
回傳參數:
String[][]:年、月、日和星期
程式功能:
取得距當月amount月的月曆
String str[][]=new String[i][2];
str[0][0]:年度
str[0][1]:月份
if i>0 then str[i][0]:日
str[i][1]:星期(星期日==1,...,星期六==7)
return str;
str中的年、月、星期的形式依yearType,monthType,weekType的value而定 |
static java.lang.String[][] |
getCalender(java.lang.String year,
java.lang.String month)
Function name:
getCalendar(String,String)
傳入參數:
String year :年度(西元年)
String month:月份
回傳參數:
String[][]:年、月、日和星期
程式功能:
取得使用者傳入年月的月曆
String str[][]=new String[i][2];
str[0][0]:年度(西元年 Ex:2000)
str[0][1]:月份(數字型態 Ex:02 或 2)
if i>0 then str[i][0]:日
str[i][1]:星期(星期日==1,...,星期六==7)
return str;
str中的年、月、星期的形式依yearType,monthType,weekType的value而定 |
static calendarServlet |
GetInstance()
Function name:
GetInstance()
傳入參數:
不需傳入參數
回傳參數:
無回傳參數
程式功能:
取得 calendarServlet 的 default
|
static calendarServlet |
GetInstance(int monthType,
int yearType,
int weekType,
int formatDate)
Function name:
GetInstance(String,String,String ,String )
傳入參數:
String monthType :月份的形式
String yearType :年度的形式
String weekType :星期的形式
String formatDate :日期的格式
回傳參數:
無回傳參數
程式功能:
使用者設定年度、月份、星期、和日期的格式
年度、月份、星期只有"1","2","3",三種型態
日期的格式有"1"~"8"八種 |
static java.lang.String |
getToday()
Function name:
getToday()
傳入參數:
不需傳入參數
回傳參數:
String:當天的日期
程式功能:
取得當天的日期
回傳當天日期的形式依 formatDate 的value而定 |
Methods inherited from class jcx.servlet.Servlet |
addCookie, checkClientTrusted, checkServerTrusted, decode, equals, fromEscapeCode, getAcceptedIssuers, getClientProperty, getCookies, getFileInputStream, getFormData, getHeader, getInputStream, getMemoryInputStream, getMethod, getOutputStream, getParameter, getPath, lzw_decompress, returnAuthenticateResponse, returnAuthenticateResponse, returnErrorResponse, returnNormalResponse, run, setHeader, ToHtml, ToSql, verify |
monthType
protected static int monthType
monthType
if monthType=1 then 月份的形式:數字(EX:01) //一月
else if monthType=2 then 月份的形式:中文(Ex:一)
else if monthType=3 then 月份的形式:英文(Ex:Jan)
else monthType=1 then 月份的形式:數字(EX:01)
yearType
protected static int yearType
yearType
if yearType=1 then 年度的形式:數字(EX:1998) //西元1998年
else if yearType=2 then 年度的形式:中文(Ex:一九九八)
else yearType=1 then 年度的形式:數字(EX:1998)
weekType
protected static int weekType
weekType
if weekType=1 then 星期的形式:數字(EX:02) //星期一
else if weekType=2 then 星期的形式:中文(Ex:一)
else if weekType=3 then 星期的形式:英文(Ex:Mon)
else weekType=1 then 星期的形式:數字(EX:02)
其中數字形式時(weekType=1),
星期日=01,星期一=02、、、星期六=07
weekType=2
星期日=日,星期一=一、、、星期六=六
weekType=3
星期日=Sun,星期一=Mon、、、星期六=Sat
formatDate
protected static int formatDate
formatDate
if formatDate=1 then 日期格式為:YEARMONTHDAY ex:20000908
else if formatDate=2 then 日期格式為:YEAR/MONTH/DAY ex:2000/09/08
else if formatDate=3 then 日期格式為:MONTH/DAY/YEAR ex:09/08/2000
else if formatDate=4 then 日期格式為:YEAR.MONTH.DAY ex:2000.09.08
else if formatDate=5 then 日期格式為:MONTH.DAY.YEAR ex:09.08.2000
else if formatDate=6 then 日期格式為:MONTH DAY,YEAR ex:Sep 08,2000
else if formatDate=7 then 日期格式為:YEAR年MONTH月DAY日 ex:2000年09月08日
else if formatDate=8 then 日期格式為:YEAR年MONTH月DAY日 ex:二000年九月八日
else formatDate=1 then 日期格式為:YEARMONTHDAY ex:20000908
calendarServlet
public calendarServlet()
GetInstance
public static calendarServlet GetInstance()
throws java.lang.Exception
Function name:
GetInstance()
傳入參數:
不需傳入參數
回傳參數:
無回傳參數
程式功能:
取得 calendarServlet 的 default
GetInstance
public static calendarServlet GetInstance(int monthType,
int yearType,
int weekType,
int formatDate)
throws java.lang.Exception
Function name:
GetInstance(String,String,String ,String )
傳入參數:
String monthType :月份的形式
String yearType :年度的形式
String weekType :星期的形式
String formatDate :日期的格式
回傳參數:
無回傳參數
程式功能:
使用者設定年度、月份、星期、和日期的格式
年度、月份、星期只有"1","2","3",三種型態
日期的格式有"1"~"8"八種
- See Also:
weekType
,
yearType
,
monthType
,
getCalender
public static java.lang.String[][] getCalender(java.lang.String year,
java.lang.String month)
throws java.lang.Exception
Function name:
getCalendar(String,String)
傳入參數:
String year :年度(西元年)
String month:月份
回傳參數:
String[][]:年、月、日和星期
程式功能:
取得使用者傳入年月的月曆
String str[][]=new String[i][2];
str[0][0]:年度(西元年 Ex:2000)
str[0][1]:月份(數字型態 Ex:02 或 2)
if i>0 then str[i][0]:日
str[i][1]:星期(星期日==1,...,星期六==7)
return str;
str中的年、月、星期的形式依yearType,monthType,weekType的value而定
- See Also:
weekType
,
yearType
,
monthType
,
getCalender
public static java.lang.String[][] getCalender()
throws java.lang.Exception
Function name:
getCalendar()
傳入參數:
不需傳入參數
回傳參數:
String[][]:年、月、日和星期
程式功能:
取得當年月的月曆
String str[][]=new String[i][2];
str[0][0]:年度
str[0][1]:月份
if i>0 then str[i][0]:日
str[i][1]:星期(星期日==1,...,星期六==7)
return str;
str中的年、月、星期的形式依yearType,monthType,weekType的value而定
- See Also:
weekType
,
yearType
,
monthType
,
getCalender
public static java.lang.String[][] getCalender(int amount)
throws java.lang.Exception
Function name:
getCalendar(int)
傳入參數:
int amount:傳回距當月amount月的月曆
Ex1:amount=-2 則傳回上上個月的月曆
若當月為2000年10月,則傳回2000年8月的月曆
Ex2:amount=2 則傳回下下個月的月曆
若當月為2000年10月,則傳回2000年12月的月曆
回傳參數:
String[][]:年、月、日和星期
程式功能:
取得距當月amount月的月曆
String str[][]=new String[i][2];
str[0][0]:年度
str[0][1]:月份
if i>0 then str[i][0]:日
str[i][1]:星期(星期日==1,...,星期六==7)
return str;
str中的年、月、星期的形式依yearType,monthType,weekType的value而定
- See Also:
weekType
,
yearType
,
monthType
,
CalculateDate
public static java.lang.String CalculateDate(java.lang.String date,
int amount)
throws java.lang.Exception
Function name:
CalculateDate(String,int)
傳入參數:
String date:日期(西元年月日 Ex:20001001)
int amount:傳回與date相距amount天的日期
回傳參數:
String:日期
程式功能:
取得與date相距amount天的日期
Ex:
String date="20001003";
if amount=-2 then return "20001001";
if amount=2 then return "20001005";
回傳日期的形式依 formatDate 的value而定
- See Also:
CalculateDays
public static int CalculateDays(java.lang.String date1,
java.lang.String date2)
throws java.lang.Exception
Function name:
CalculateDays(String,String)
傳入參數:
String date1:日期(西元年月日 Ex:20001003)
String date2:日期(西元年月日 Ex:20001001)
回傳參數:
int:date1 與 date2相距的天數(date1-date2)
程式功能:
取得date1 與 date2相距的天數
Ex:
String date1="20001003";
if date2="20001001" then return 2;
if date2="20001005" then return -2;
getToday
public static java.lang.String getToday()
throws java.lang.Exception
Function name:
getToday()
傳入參數:
不需傳入參數
回傳參數:
String:當天的日期
程式功能:
取得當天的日期
回傳當天日期的形式依 formatDate 的value而定
- See Also:
formatedTime
public static java.lang.String formatedTime(java.lang.String time,
java.lang.String time_type)
throws java.lang.Exception
將傳入的 time 格式化,格式化的格式:
time_type="w" :time表示為星期日(=1)∼星期六(=7)中的一天。
可設定weekType來設定格式化的形式。
Ex:Suppose time="2";
if weekType==2 then return "一";
else if weekType==3 then return "Mon";
else return time;
time_type="y" :time表示是年度。
可設定yearType來設定格式化的形式
Ex:Suppose time="1998";
if yearType==2 then return "一九九八";
else return time;
time_type="m" ;time表示是月份。
可設定monthType來設定格式化的形式
Ex:Suppose time="01";
if monthType==2 then return "0一";
else monthType==3 then return "Jan";
else return time;
time_type="d" ;time表示是日期。
只做中文化格式。
Ex:Suppose time="03"; return "0三";
time_type="date";time表示是年月日。
可設定formatDate來設定格式化的形式
Ex:Suppose time="19980102";
if formatDate==2 then return "1998/01/02";
else if formatDate==3 then return "01/02/1998";
、、、、、、
else if formatDate==8 then return "一九九八年0一月0二日";
- Parameters:
time
- 依 time_type 的 value 不同而有不同的意義,以數字型態傳入。time_type
- 指定 time 所代表的意思- Returns:
- 回傳格式化的結果
- See Also:
weekType
,
yearType
,
monthType
,