이 필드의 라벨을 가져옵니다. 필드, 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());}
// 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');
// 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();}
참고: 표준 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());
// 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());
// 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());
// 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);
// 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);
// 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);
[[["이해하기 쉬움","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"]],["최종 업데이트: 2024-12-22(UTC)"],[[["**Deprecated:** The `DateField` class is deprecated; use the People API advanced service instead."],["Represents a date field within a Contact, specifically for the Contacts service."],["Offers limited functionality with `getLabel()` and `setLabel()` methods for managing date field labels."],["Previously provided methods for manipulating date values are now deprecated, including `getDay()`, `getMonth()`, `getYear()`, and `setDate()`."],["For general date manipulation in Apps Script, use JavaScript's standard `Date` object."]]],[]]