برچسب این فیلد را مانند "تولد" یا "سالگرد" تنظیم می کند.
مستندات دقیق
get Label()
برچسب این فیلد را دریافت می کند. این ممکن است یک فیلد، ExtendedField یا یک رشته باشد.
// Logs the label for all the address fields associated with contact// 'John Doe'. This method can be similarly called for any field that has// a label.constcontacts=ContactsApp.getContactsByName('John Doe');constaddressFields=contacts[0].getAddresses();for(leti=0;i < addressFields.length;i++){Logger.log(addressFields[i].getLabel());}
بازگشت
Object - برچسب این فیلد
مجوز
اسکریپت هایی که از این روش استفاده می کنند نیاز به مجوز با یک یا چند مورد از حوزه های زیر دارند:
https://www.google.com/m8/feeds
set Label(label)
برچسب این فیلد را تنظیم می کند.
// Sets the label to 'Apartment' for the first address field associated// with contact 'John Doe'. This method can be similarly called for any// field that has a label.constcontacts=ContactsApp.getContactsByName('John Doe');constaddressFields=contacts[0].getAddresses();addressFields[0].setLabel('Apartment');
اسکریپت هایی که از این روش استفاده می کنند نیاز به مجوز با یک یا چند مورد از حوزه های زیر دارند:
https://www.google.com/m8/feeds
روش های منسوخ شده
delete Date Field()
منسوخ شده است. این تابع منسوخ شده است و نباید در اسکریپت های جدید استفاده شود.
این تاریخ را حذف می کند.
// Deletes all the dates that are set for contact 'John Doe'constcontacts=ContactsApp.getContactsByName('John Doe');constdates=contacts[0].getDates();for(leti=0;i < dates.length;i++){dates[i].deleteDateField();}
مجوز
اسکریپت هایی که از این روش استفاده می کنند نیاز به مجوز با یک یا چند مورد از حوزه های زیر دارند:
https://www.google.com/m8/feeds
get Day()
منسوخ شده است. این تابع منسوخ شده است و نباید در اسکریپت های جدید استفاده شود.
روز ماه را برای این تاریخ دریافت می کند.
توجه: برای آبجکتهای استاندارد تاریخ جاوا اسکریپت، متد get Day() روز هفته را برمیگرداند.
// Logs the day of the birthday for contact 'John Doe'constcontacts=ContactsApp.getContactsByName('John Doe');constbirthday=contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];Logger.log(birthday.getDay());
بازگشت
Integer - روز ماه
مجوز
اسکریپت هایی که از این روش استفاده می کنند نیاز به مجوز با یک یا چند مورد از حوزه های زیر دارند:
https://www.google.com/m8/feeds
get Month()
منسوخ شده است. این تابع منسوخ شده است و نباید در اسکریپت های جدید استفاده شود.
ماه این تاریخ را دریافت می کند.
// Logs the month of the birthday for contact 'John Doe'constcontacts=ContactsApp.getContactsByName('John Doe');constbirthday=contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];Logger.log(birthday.getMonth());
اسکریپت هایی که از این روش استفاده می کنند نیاز به مجوز با یک یا چند مورد از حوزه های زیر دارند:
https://www.google.com/m8/feeds
get Year()
منسوخ شده است. این تابع منسوخ شده است و نباید در اسکریپت های جدید استفاده شود.
سال این تاریخ را دریافت می کند.
// Logs the year of the birthday for contact 'John Doe'constcontacts=ContactsApp.getContactsByName('John Doe');constbirthday=contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];Logger.log(birthday.getYear());
بازگشت
Integer - سال
مجوز
اسکریپت هایی که از این روش استفاده می کنند نیاز به مجوز با یک یا چند مورد از حوزه های زیر دارند:
https://www.google.com/m8/feeds
set Date(month, day)
منسوخ شده است. این تابع منسوخ شده است و نباید در اسکریپت های جدید استفاده شود.
تاریخ را بدون یک سال به امروز تنظیم می کند.
این روش فقط برای فیلدهای تاریخ که به یک سال نیاز ندارند، مانند تاریخ تولد، اعمال می شود.
// Sets the birthday for contact 'John Doe' to April 1constcontacts=ContactsApp.getContactsByName('John Doe');constbirthday=contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];birthday.setDate(ContactsApp.Month.APRIL,1);
اسکریپت هایی که از این روش استفاده می کنند نیاز به مجوز با یک یا چند مورد از حوزه های زیر دارند:
https://www.google.com/m8/feeds
set Date(month, day, year)
منسوخ شده است. این تابع منسوخ شده است و نباید در اسکریپت های جدید استفاده شود.
تاریخ را به این روز تنظیم می کند.
// Sets the birthday for contact 'John Doe' to April 1, 1980constcontacts=ContactsApp.getContactsByName('John Doe');constbirthday=contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];birthday.setDate(ContactsApp.Month.APRIL,1,1980);
اسکریپت هایی که از این روش استفاده می کنند نیاز به مجوز با یک یا چند مورد از حوزه های زیر دارند:
https://www.google.com/m8/feeds
set Label(label)
منسوخ شده است. این تابع منسوخ شده است و نباید در اسکریپت های جدید استفاده شود.
برچسب این فیلد را مانند "تولد" یا "سالگرد" تنظیم می کند.
// Retrieves the first date that's set for contact 'John Doe' and re-labels// it as an anniversaryconstcontacts=ContactsApp.getContactsByName('John Doe');constfirstDate=contacts[0].getDates()[0];firstDate.setLabel(ContactsApp.Field.ANNIVERSARY);
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003e\u003cstrong\u003eDeprecated:\u003c/strong\u003e The \u003ccode\u003eDateField\u003c/code\u003e class is deprecated; use the People API advanced service instead.\u003c/p\u003e\n"],["\u003cp\u003eRepresents a date field within a Contact, specifically for the Contacts service.\u003c/p\u003e\n"],["\u003cp\u003eOffers limited functionality with \u003ccode\u003egetLabel()\u003c/code\u003e and \u003ccode\u003esetLabel()\u003c/code\u003e methods for managing date field labels.\u003c/p\u003e\n"],["\u003cp\u003ePreviously provided methods for manipulating date values are now deprecated, including \u003ccode\u003egetDay()\u003c/code\u003e, \u003ccode\u003egetMonth()\u003c/code\u003e, \u003ccode\u003egetYear()\u003c/code\u003e, and \u003ccode\u003esetDate()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eFor general date manipulation in Apps Script, use JavaScript's standard \u003ccode\u003eDate\u003c/code\u003e object.\u003c/p\u003e\n"]]],[],null,["# Class DateField\n\nDateField\n\n\n**Deprecated.** Instead, use the [People API advanced\nservice](/apps-script/advanced/people)\n\nA date field in a Contact.\n\nThis class is only used by the Contacts service, and dates used elsewhere in App Script use\nJavaScript's standard [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object. \n\n### Methods\n\n| Method | Return type | Brief description |\n|--------------------------------------|----------------|--------------------------------|\n| [getLabel()](#getLabel()) | `Object` | Gets the label for this field. |\n| [setLabel(label)](#setLabel(String)) | [DateField](#) | Sets the label of this field. |\n\n### Deprecated methods\n\n| Method | Return type | Brief description |\n|--------------------------------------------------------------|-----------------------------|--------------------------------------------------------------------|\n| [deleteDateField()](#deleteDateField()) | `void` | Deletes this date. |\n| [getDay()](#getDay()) | `Integer` | Gets the day of the month for this date. |\n| [getMonth()](#getMonth()) | [Month](../base/month.html) | Gets the month for this date. |\n| [getYear()](#getYear()) | `Integer` | Gets the year for this date. |\n| [setDate(month, day)](#setDate(Month,Integer)) | [DateField](#) | Sets the date to this day, without a year. |\n| [setDate(month, day, year)](#setDate(Month,Integer,Integer)) | [DateField](#) | Sets the date to this day. |\n| [setLabel(label)](#setLabel(Field)) | [DateField](#) | Sets the label of this field, such as 'Birthday' or 'Anniversary'. |\n\nDetailed documentation\n----------------------\n\n### `get``Label()`\n\nGets the label for this field. This may be a Field, ExtendedField, or a String.\n\n```javascript\n// Logs the label for all the address fields associated with contact\n// 'John Doe'. This method can be similarly called for any field that has\n// a label.\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst addressFields = contacts[0].getAddresses();\nfor (let i = 0; i \u003c addressFields.length; i++) {\n Logger.log(addressFields[i].getLabel());\n}\n```\n\n#### Return\n\n\n`Object` --- the label for this field\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `set``Label(label)`\n\nSets the label of this field.\n\n```javascript\n// Sets the label to 'Apartment' for the first address field associated\n// with contact 'John Doe'. This method can be similarly called for any\n// field that has a label.\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst addressFields = contacts[0].getAddresses();\naddressFields[0].setLabel('Apartment');\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|----------|------------------------------|\n| `label` | `String` | the new label for this field |\n\n#### Return\n\n\n[DateField](#) --- this field, useful for chaining\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\nDeprecated methods\n------------------\n\n### `delete``Date``Field()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nDeletes this date.\n\n```javascript\n// Deletes all the dates that are set for contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst dates = contacts[0].getDates();\nfor (let i = 0; i \u003c dates.length; i++) {\n dates[i].deleteDateField();\n}\n```\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `get``Day()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nGets the day of the month for this date.\n\nNote: For standard JavaScript Date objects the [`get``Day()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay) method returns the day of the week instead.\n\n```javascript\n// Logs the day of the birthday for contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];\nLogger.log(birthday.getDay());\n```\n\n#### Return\n\n\n`Integer` --- the day of the month\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `get``Month()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nGets the month for this date.\n\n```javascript\n// Logs the month of the birthday for contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];\nLogger.log(birthday.getMonth());\n```\n\n#### Return\n\n\n[Month](../base/month.html) --- the month\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `get``Year()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nGets the year for this date.\n\n```javascript\n// Logs the year of the birthday for contact 'John Doe'\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];\nLogger.log(birthday.getYear());\n```\n\n#### Return\n\n\n`Integer` --- the year\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `set``Date(month, day)`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nSets the date to this day, without a year.\n\nThis method only applies to date fields that don't require a year, such as birthdays.\n\n```javascript\n// Sets the birthday for contact 'John Doe' to April 1\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];\nbirthday.setDate(ContactsApp.Month.APRIL, 1);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|-----------------------------|-------------|\n| `month` | [Month](../base/month.html) | the month |\n| `day` | `Integer` | the day |\n\n#### Return\n\n\n[DateField](#) --- this date, useful for chaining\n\n#### Throws\n\n\n[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if this date field requires a year\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `set``Date(month, day, year)`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nSets the date to this day.\n\n```javascript\n// Sets the birthday for contact 'John Doe' to April 1, 1980\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst birthday = contacts[0].getDates(ContactsApp.Field.BIRTHDAY)[0];\nbirthday.setDate(ContactsApp.Month.APRIL, 1, 1980);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|-----------------------------|-------------|\n| `month` | [Month](../base/month.html) | the month |\n| `day` | `Integer` | the day |\n| `year` | `Integer` | the year |\n\n#### Return\n\n\n[DateField](#) --- this date, useful for chaining\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`\n\n*** ** * ** ***\n\n### `set``Label(label)`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nSets the label of this field, such as 'Birthday' or 'Anniversary'.\n\n```javascript\n// Retrieves the first date that's set for contact 'John Doe' and re-labels\n// it as an anniversary\nconst contacts = ContactsApp.getContactsByName('John Doe');\nconst firstDate = contacts[0].getDates()[0];\nfirstDate.setLabel(ContactsApp.Field.ANNIVERSARY);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|------------------------------------------------|------------------------|\n| `label` | [Field](/apps-script/reference/contacts/field) | the new standard label |\n\n#### Return\n\n\n[DateField](#) --- this field, useful for chaining\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.google.com/m8/feeds`"]]