لضبط تصنيف هذا الحقل، مثل "عيد ميلاد" أو "ذكرى سنوية"
مستندات تفصيلية
getLabel()
تحصل على تصنيف هذا الحقل. قد يكون هذا الحقل أو ExtendedField أو String.
// 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
setLabel(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
الطرق المتوقّفة
deleteDateField()
تمّ إيقاف هذا العمود نهائيًا. تم إيقاف هذه الدالة نهائيًا ويجب عدم استخدامها في النصوص البرمجية الجديدة.
يؤدي إلى حذف هذا التاريخ.
// 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
getDay()
تمّ إيقاف هذا العمود نهائيًا. تم إيقاف هذه الدالة نهائيًا ويجب عدم استخدامها في النصوص البرمجية الجديدة.
تحصل على اليوم من الشهر لهذا التاريخ.
ملاحظة: بالنسبة إلى عناصر JavaScript Date العادية، تعرض الطريقة getDay() يوم الأسبوع بدلاً من ذلك.
// 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
getMonth()
تمّ إيقاف هذا العمود نهائيًا. تم إيقاف هذه الدالة نهائيًا ويجب عدم استخدامها في النصوص البرمجية الجديدة.
تحصل على شهر هذا التاريخ.
// 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
getYear()
تمّ إيقاف هذا العمود نهائيًا. تم إيقاف هذه الدالة نهائيًا ويجب عدم استخدامها في النصوص البرمجية الجديدة.
تحصل على السنة لهذا التاريخ.
// 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
setDate(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
setDate(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
setLabel(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-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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,["DateField\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\nMethods\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\nDeprecated 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`get``Label()` \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\nReturn\n\n\n`Object` --- the label for this field\n\nAuthorization\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)` \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\nParameters\n\n| Name | Type | Description |\n|---------|----------|------------------------------|\n| `label` | `String` | the new label for this field |\n\nReturn\n\n\n[DateField](#) --- this field, useful for chaining\n\nAuthorization\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`delete``Date``Field()` \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\nAuthorization\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**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\nReturn\n\n\n`Integer` --- the day of the month\n\nAuthorization\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**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\nReturn\n\n\n[Month](../base/month.html) --- the month\n\nAuthorization\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**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\nReturn\n\n\n`Integer` --- the year\n\nAuthorization\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**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\nParameters\n\n| Name | Type | Description |\n|---------|-----------------------------|-------------|\n| `month` | [Month](../base/month.html) | the month |\n| `day` | `Integer` | the day |\n\nReturn\n\n\n[DateField](#) --- this date, useful for chaining\n\nThrows\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\nAuthorization\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**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\nParameters\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\nReturn\n\n\n[DateField](#) --- this date, useful for chaining\n\nAuthorization\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**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\nParameters\n\n| Name | Type | Description |\n|---------|------------------------------------------------|------------------------|\n| `label` | [Field](/apps-script/reference/contacts/field) | the new standard label |\n\nReturn\n\n\n[DateField](#) --- this field, useful for chaining\n\nAuthorization\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`"]]