[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eThe Access Context Manager allows for setting access controls based on specific dates and times, enabling restriction of user access to resources during defined periods.\u003c/p\u003e\n"],["\u003cp\u003eTime zone can be specified using UTC, fixed time zones, or named time zones like \u003ccode\u003eEurope/Paris\u003c/code\u003e, and if left unspecified, the expression defaults to UTC.\u003c/p\u003e\n"],["\u003cp\u003eFunctions like \u003ccode\u003egetFullYear\u003c/code\u003e, \u003ccode\u003egetMonth\u003c/code\u003e, \u003ccode\u003egetDate\u003c/code\u003e, \u003ccode\u003egetDayOfWeek\u003c/code\u003e, \u003ccode\u003egetHours\u003c/code\u003e, and \u003ccode\u003egetMinutes\u003c/code\u003e can be used to construct precise date and time-based access conditions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebetween\u003c/code\u003e function is available to be used for both \u003ccode\u003eTimestamp\u003c/code\u003e and \u003ccode\u003eTimeOfDay\u003c/code\u003e in order to define a time range for a given timestamp, and can also be used to define time ranges with string inputs.\u003c/p\u003e\n"],["\u003cp\u003eExample policies include allowing access during specific work hours and excluding holidays, as well as enabling temporary access within a specific date and time range, and these policies can be expressed using a variety of the provided functions.\u003c/p\u003e\n"]]],[],null,["# Configuring time and day access conditions\n\nThe Access Context Manager date and time restriction feature gives enterprises the ability to set access controls based on the date and time.\n\nWhen evaluating zero-trust access, it is often necessary to restrict user access to resources to specific days and times. For example, shift workers may only be allowed to access company resources during their shift hours, or users may be given temporary access between a particular time of the day.\n\nTo apply the time and day access level condition, use the functions listed in the following table. The format of the functions is `function(timezone)`.\n\nYou can specify `timezone` as UTC, fixed time zones which are explicit hour and minute offsets from UTC, or as long `timezone` names like `Europe/Paris`, `CET`, or `US/Central`. For a complete listing, see the [Timezone](https://github.com/google/cel-spec/blob/master/doc/langdef.md#timezones) section of the Common Express Language definition.\n\nIf you don't specify a 'timezone', the expression defaults to UTC.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThe following table contains examples of how to use time and date restrictions:\n\nFollowing are some example expressions that use some of the functions to capture specific time ranges:\n\n**Express the range during business hours** \n\nThe date-time format is 'HH:MM:SS' and follows the RFC 3339 standard. \n\n request.time.timeOfDay('America/Los_Angeles').between('09:30:00', '17:30:00')\n\n request.time.date('America/Los_Angeles')\n .between('01-10-2020T00:00:00+08:00', '01-11-2020T00:00:00-07:00')\n\n**Express specific days of the month, first week** \n\n(Note support for alternative timezone format) \n\n request.time.getDayOfMonth('America/Los_Angeles') \u003c 7\n\n**Express specific date ranges, yearly** \n\nFor example, for quarterly reporting. \n\n request.time.date('Asia/Hong_Kong').between(\n request.time.getFullYear('08:00') + '-12-15T00:00:00+08:00',\n request.time.getFullYear('08:00')+1 + '-01-01T00:00:00+08:00')"]]