Class TimePicker
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
시간선택 도구
사용자가 시간을 입력할 수 있는 입력란입니다.
Google Workspace 부가기능 및 Google Chat 앱에서 사용할 수 있습니다.
const dateTimePicker =
CardService.newTimePicker()
.setTitle('Enter the time.')
.setFieldName('time_field')
// Set default value as 3:30 AM.
.setHours(3)
.setMinutes(30)
.setOnChangeAction(
CardService.newAction().setFunctionName('handleDateTimeChange'),
);
자세한 문서
setFieldName(fieldName)
UI 상호작용이 있을 때 생성되는 이벤트 객체에서 이 선택 도구를 식별하는 필드 이름을 설정합니다. 필드 이름은 사용자에게 표시됩니다. 필수사항입니다. 지정된 필드 이름은 고유해야 합니다.
매개변수
이름 | 유형 | 설명 |
fieldName | String | 이 입력에 할당할 이름입니다. |
리턴
TimePicker
: 체이닝을 위한 선택 도구입니다.
setHours(hours)
입력란에 설정할 사전 입력된 시간 값을 설정합니다.
매개변수
이름 | 유형 | 설명 |
hours | Integer | 입력에 배치되는 기본 시간 값의 범위는 0~23입니다. 항상 양식 콜백 매개변수에서 문자열로 표현됩니다. |
리턴
TimePicker
: 체이닝을 위한 선택 도구입니다.
setMinutes(minutes)
입력란에 설정할 미리 채워진 분 값을 설정합니다.
매개변수
이름 | 유형 | 설명 |
minutes | Integer | 입력에 배치되는 기본 분 값의 범위는 0~59입니다. 항상 양식 콜백 매개변수에서 문자열로 표현됩니다. |
리턴
TimePicker
: 체이닝을 위한 선택 도구입니다.
setOnChangeAction(action)
선택 도구 입력이 변경될 때마다 스크립트가 실행하는 Action
를 설정합니다.
매개변수
리턴
TimePicker
: 체이닝을 위한 선택 도구입니다.
setTitle(title)
입력란 위에 표시되는 제목을 설정합니다.
매개변수
이름 | 유형 | 설명 |
title | String | 입력란 제목입니다. |
리턴
TimePicker
: 체이닝을 위한 선택 도구입니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eTimePicker is an input field that allows users to input a time, available for Google Workspace Add-ons and Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can prefill the TimePicker with a default time using \u003ccode\u003esetHours\u003c/code\u003e and \u003ccode\u003esetMinutes\u003c/code\u003e, and set a title using \u003ccode\u003esetTitle\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esetFieldName\u003c/code\u003e assigns a unique identifier for the picker, used in event objects for UI interactions.\u003c/p\u003e\n"],["\u003cp\u003eAn \u003ccode\u003eOnChangeAction\u003c/code\u003e can be set to trigger a specific script function whenever the picker's input value is modified.\u003c/p\u003e\n"]]],[],null,["# Class TimePicker\n\nTimePicker\n\nAn input field that allows users to input a time.\n\nAvailable for Google Workspace add-ons and Google Chat apps.\n\n```javascript\nconst dateTimePicker =\n CardService.newTimePicker()\n .setTitle('Enter the time.')\n .setFieldName('time_field')\n // Set default value as 3:30 AM.\n .setHours(3)\n .setMinutes(30)\n .setOnChangeAction(\n CardService.newAction().setFunctionName('handleDateTimeChange'),\n );\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------|-----------------|--------------------------------------------------------------------------------------------------------------------------|\n| [setFieldName(fieldName)](#setFieldName(String)) | [TimePicker](#) | Sets the field name that identifies this picker in the event object that is generated when there is a UI interaction. |\n| [setHours(hours)](#setHours(Integer)) | [TimePicker](#) | Sets the prefilled hours value to set in the input field. |\n| [setMinutes(minutes)](#setMinutes(Integer)) | [TimePicker](#) | Sets the prefilled minutes value to set in the input field. |\n| [setOnChangeAction(action)](#setOnChangeAction(Action)) | [TimePicker](#) | Sets an [Action](/apps-script/reference/card-service/action) that the script performs whenever the picker input changes. |\n| [setTitle(title)](#setTitle(String)) | [TimePicker](#) | Sets the title displayed above the input field. |\n\nDetailed documentation\n----------------------\n\n### `set``Field``Name(fieldName)`\n\nSets the field name that identifies this picker in the event object that is generated when\nthere is a UI interaction. The field name is visible to the user. Required; the specified field\nname must be unique.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------|----------|-----------------------------------|\n| `field``Name` | `String` | The name to assign to this input. |\n\n#### Return\n\n\n[TimePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n### `set``Hours(hours)`\n\nSets the prefilled hours value to set in the input field.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|-----------|---------------------------------------------------------------------------------------------------------------------------------------|\n| `hours` | `Integer` | The default hour value placed in the input, range from 0 to 23. It is always represented as a string in the form callback parameters. |\n\n#### Return\n\n\n[TimePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n### `set``Minutes(minutes)`\n\nSets the prefilled minutes value to set in the input field.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------|-----------|------------------------------------------------------------------------------------------------------------------------------------------|\n| `minutes` | `Integer` | The default minutes value placed in the input, range from 0 to 59. It is always represented as a string in the form callback parameters. |\n\n#### Return\n\n\n[TimePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n### `set``On``Change``Action(action)`\n\nSets an [Action](/apps-script/reference/card-service/action) that the script performs whenever the picker input changes.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|---------------------|\n| `action` | [Action](/apps-script/reference/card-service/action) | The action to take. |\n\n#### Return\n\n\n[TimePicker](#) --- This picker, for chaining.\n\n*** ** * ** ***\n\n### `set``Title(title)`\n\nSets the title displayed above the input field.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|----------|------------------------|\n| `title` | `String` | The input field title. |\n\n#### Return\n\n\n[TimePicker](#) --- This picker, for chaining."]]