Event and Date Functions

STRING date(EVENT);

date of, value of first DATE line

STRING place(EVENT);

place of, value of first PLAC line

STRING year(EVENT);

year or, 1st string of 3–4 digits in 1st DATE line

STRING long(EVENT);

date and place, values of 1st DATE and PLAC lines

STRING short(EVENT);

date and place of, abbreviated from

EVENT gettoday(void);

returns the “event” of the current date

VOID dayformat(INT);

set day format for stddate calls

VOID monthformat(INT);

set month format for stddate calls

VOID dateformat(INT);

set date format for stddate calls

STRING stddate(EVENT);

date of, in current format

These functions extract information about the dates and places of events.

Date returns the value of the first DATE line in an event, a node in a GEDCOM record tree. Date finds the first DATE line one level deeper than the event node. Place returns the value of the first PLAC line in an event. Year returns the first three or four digit number in the value of the first DATE line in an event; this number is assumed to be the year of the event.

Long returns the verbatim values of the first DATE and PLAC lines in an event, catenated together and separated by a comma. Short abbreviates information from the first DATE and PLAC lines, catenates the shortened information together with a comma separator and returns it. An abbreviated date is its year; an abbreviated place is the last component in the value, further abbreviated if the component has an entry in the place abbreviation table.

Gettoday creates an event that has today’s date in the DATE line.

The last four functions are used to format dates in a variety of ways. Dayformat, monthformat, and dateformat select style options for formatting the day, month, and overall date structure; stddate returns dates in the selected style. The day format codes passed to dayformat are:

0

leave space before single digit days

1

use leading 0 before single digit days

2

no space or leading 0 before single digit days

The month format codes passed to monthformat are:

0

number with space before single digit months

1

number with leading zero before single digit months

2

number with no space or zero before single digit months

3

upper case abbreviation (eg, JAN, FEB)

4

capitalized abbreviation (eg, Jan, Feb)

5

upper case full word (eg, JANUARY, FEBRUARY)

6

capitalized full word (eg, January, February)

The full date formats passed to stddate are:

0

da mo yr

1

mo da, yr

2

mo/da/yr

3

da/mo/yr

4

mo-da-yr

5

da-mo-yr

6

modayr

7

damoyr

8

yr mo da

9

yr/mo/da

10

yr-mo-da

11

yrmoda