Sun Java System Web Proxy Server 4.0.4 管理指南

dateRange() (day, month, year...)

dateRange()() 函數會偵測特定日期或日期範圍,例如 1996 年 4 月 19 日到 1996 年 5 月 3 日。若要讓 FindProxyForURL() 函數根據星期幾而有不同的運作方式 (例如,需要針對其中一個代理伺服器定期排程停機維護時間),此函數就非常有用。

您可以使用數種方式指定日期範圍:

dateRange(day)dateRange(day1, day2)dateRange(mon)dateRange(month1, month2)dateRange(year)dateRange(year1, year2)dateRange(day1, month1, day2, month2)dateRange(month1, year1, month2, year2)dateRange(day1, month1, year1, day2, month2, year2)dateRange(day1, month1, year1, day2, month2, year2, gmt)

參數

day 是 1 到 31 之間的整數,代表每月中的第幾天。

month 必須是下列其中一個月份字串:JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC

year 是四位整數的年份 (例如,1996)。

gmt 可以使用「GMT」字串表示,代表應以格林威治標準時間來比較時間,也可以留白表示使用本地時區。GMT 參數也可以指定於任何呼叫設定檔中,它始終做為最後一個參數。若在每個種類 (日、月、年) 中僅指定單一值,則此函數只在與指定值相符的日期傳回 true 值。若指定兩個值,則從第一個指定時間到第二個指定時間之間都會傳回 true 結果值。

範例

此敘述在每月第一天 (本地時區) 會傳回 true:dateRange(1)

此敘述在每月第一天 (格林威治標準時間) 會傳回 true:dateRange(1, "GMT")

此敘述在每月的上半月都會傳回 true:dateRange(1, 15)

此敘述在每年 12 月 24 日會傳回 true:dateRange(24, "DEC")

此敘述在 1995 年 12 月 24 日會傳回 true:dateRange(24, "DEC", 1995)

此敘述在每年第一季都會傳回 true:dateRange("JAN", "MAR")

此敘述在每年 6 月 1 日到 8 月 15 日都會傳回 true: dateRange(1, "JUN", 15, "AUG")

此敘述在 1995 年 6 月 1 日到 1995 年 8 月 15 日都會傳回 true:dateRange(1, "JUN", 15, 1995, "AUG", 1995)

此敘述在 1995 年 10 月到 1996 年 3 月都會傳回 true:dateRange("OCT", 1995, "MAR", 1996)

此敘述在 1995 年整年都會傳回 true:dateRange(1995)

此敘述在 1995 年初到 1997 年末都會傳回 true:dateRange(1995, 1997)