public class Birthday extends DateOrTimeProperty
Defines the person's birthday.
Code sample (creating)
VCard vcard = new VCard(); //date Calendar c = Calendar.getInstance(); c.clear(); c.set(Calendar.YEAR, 1912); c.set(Calendar.MONTH, Calendar.JUNE); c.set(Calendar.DAY_OF_MONTH, 23); Birthday bday = new Birthday(c.getTime()); vcard.setBirthday(bday); //partial date (e.g. just the month and date, vCard 4.0 only) bday = new Birthday(PartialDate.date(null, 6, 23)); //June 23 vcard.setBirthday(bday); //plain text value (vCard 4.0 only) bday = new Birthday("Don't even go there, dude..."); vcard.setBirthday(bday);
Code sample (retrieving)
VCard vcard = ... Birthday bday = vcard.getBirthday(); Date date = bday.getDate(); if (date != null){ //property value is a date } PartialDate partialDate = bday.getPartialDate(); if (partialDate != null){ //property value is a partial date int year = partialDate.getYear(); int month = partialDate.getMonth(); } String text = bday.getText(); if (text != null){ //property value is plain text }
Property name: BDAY
Supported versions: 2.1, 3.0, 4.0
group, parameters
Constructor and Description |
---|
Birthday(Date date)
Creates a birthday property.
|
Birthday(Date date,
boolean hasTime)
Creates a birthday property.
|
Birthday(PartialDate partialDate)
Creates a birthday property.
|
Birthday(String text)
Creates a birthday property.
|
_validate, getAltId, getCalscale, getDate, getPartialDate, getText, hasTime, setAltId, setCalscale, setDate, setPartialDate, setText
_supportedVersions, addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, removeParameter, setGroup, setParameter, setParameters, validate
public Birthday(Date date)
date
- the birthdaypublic Birthday(Date date, boolean hasTime)
date
- the birthdayhasTime
- true to include the date's time component, false if it's
strictly a datepublic Birthday(PartialDate partialDate)
partialDate
- the birthday (vCard 4.0 only)public Birthday(String text)
text
- the text value (vCard 4.0 only)This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.