Stay organized with collections Save and categorize content based on your preferences.
DateTimePickerAn input field that allows users to input a date and time.
Supports form submission validation. When Action.setAllWidgetsAreRequired(allWidgetsAreRequired)
is set to true
or this widget is specified through Action.addRequiredWidget(requiredWidget)
, the submission action is blocked unless a value is selected.
Available for Google Workspace add-ons and Google Chat apps.
const dateTimePicker = CardService.newDateTimePicker() .setTitle('Enter the date and time.') .setFieldName('date_time_field') // Set default value as Jan 1, 2018, 3:00 AM UTC. Either a number or // string is acceptable. .setValueInMsSinceEpoch(1514775600) // EDT time is 5 hours behind UTC. .setTimeZoneOffsetInMins(-5 * 60) .setOnChangeAction( CardService.newAction().setFunctionName('handleDateTimeChange'), );Detailed documentation
setFieldName(fieldName)
Sets the field name that identifies this picker in the event object that is generated when there is a UI interaction. The field name is visible to the user. Required; the specified field name must be unique.
Parameters Name Type DescriptionfieldName
String
The name to assign to this input. Return
DateTimePicker
— This picker, for chaining.
setOnChangeAction(action)
Sets an Action
that the script performs whenever the picker input changes.
action
Action
The action to take. Return
DateTimePicker
— This picker, for chaining.
setTimeZoneOffsetInMins(timeZoneOffsetMins)
Sets the number of minutes that the time zone should be offset from UTC. If set, the date and time is displayed in the specified time zone. If not set, the time is displayed in the user's time zone.
Parameters Name Type DescriptiontimeZoneOffsetMins
Integer
The number of minutes that the time zone is offset from UTC. Return
DateTimePicker
— This picker, for chaining.
setTitle(title)
Sets the title displayed above the input field.
Parameters Name Type Descriptiontitle
String
The input field title. Return
DateTimePicker
— This picker, for chaining.
setValueInMsSinceEpoch(valueMsEpoch)
Sets the prefilled value to be set in the input field.
Parameters Name Type DescriptionvalueMsEpoch
Number
The default value placed in the input as a number, in milliseconds since the epoch. It is always represented as a string in the form callback parameters. Return
DateTimePicker
— This picker, for chaining.
setValueInMsSinceEpoch(valueMsEpoch)
Sets the prefilled value to be set in the input field.
Parameters Name Type DescriptionvalueMsEpoch
String
The default value placed in the input as a string, in milliseconds since the epoch. It is always represented as a string in the form callback parameters. Return
DateTimePicker
— This picker, for chaining.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-01-30 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-30 UTC."],[[["DateTimePicker is an input field that allows users to input both a date and a time within Google Workspace Add-ons and Google Chat apps."],["It provides functionalities to set a title, a default value, and a specific time zone for the date and time selection."],["Developers can set a field name for identifying the picker in events, and trigger custom actions when the input changes using `setOnChangeAction()`."],["The prefilled value can be set using milliseconds since the epoch, represented as either a number or a string."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4