DateStruct (Media Authoring with Java API)
Date: 2016-02-05

tv.amwa.maj.record

## Interface DateStruct

- All Known Implementing Classes:
    DateStructImpl

      public interface DateStruct

  Specifies the date component of timestamp values that are specified according to Coordinated Universal Time (UTC). AAF represents dates with year, month and day of the month components.

  To make values of this type, use the following methods from the MAJ forge:

  - From its component values: `Forge.makeDate(byte, byte, short)`;
  - From an existing Java Calendar value: `Forge.makeDate(Calendar)`;
  - For today's date: `Forge.todaysDate()`;
  - From a string representation similar to an XML schema date type as generated by `toString()`: `Forge.parseDate(String)`.
  See Also:
    `TypeDefinitions.DateStruct`, `TimeStamp`, `TimeStruct`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `DateStruct` | `clone()` Create a cloned copy of this date value.
    `Calendar` | `getDateValue()` Returns a `Calendar` value representing the date represented by this value.
    `byte` | `getDay()` Returns the day of the month component of the date.
    `byte` | `getMonth()` Returns the month component of the date, which is in the range 1 to 12.
    `short` | `getYear()` Returns the year component of the date.
    `void` | `setDate(byte day, byte month, short year)` Simultaneously set the components of date structure value with the given day, month and year.
    `void` | `setDay(byte day)` Set the day of the month component of the date, in the range 1 to 31.
    `void` | `setMonth(byte month)` Set the month component of the date, which is in the range 1 to 12.
    `void` | `setYear(short year)` Sets the year component of the date, in the range -9999 to 9999.
    `String` | `toString()` Formats the date value as a UTC date-only value.

- - ### Method Detail

    - #### setDate

          void setDate(@UInt8
                       byte day,
                       @UInt8
                       byte month,
                       @Int16
                       short year)
                throws IllegalArgumentException

      Simultaneously set the components of date structure value with the given day, month and year.

      Parameters:
        `day` - Day of the month component of the date.
        `month` - Month component of the date.
        `year` - Year component of the date.
      Throws:
        `IllegalArgumentException` - One or more of the component values is outside the acceptable range for their values, or the specified date does not exist.

    - #### getDay

          @UInt8
          byte getDay()

      Returns the day of the month component of the date.

      Returns:
        Day of the month component of the date.

    - #### setDay

          void setDay(@UInt8
                      byte day)
               throws IllegalArgumentException

      Set the day of the month component of the date, in the range 1 to 31.

      Parameters:
        `day` - Day of the month component of the date.
      Throws:
        `IllegalArgumentException` - Provided day value is outside the acceptable range.

    - #### getMonth

          @UInt8
          byte getMonth()

      Returns the month component of the date, which is in the range 1 to 12.

      Returns:
        Month component of the date.

    - #### setMonth

          void setMonth(@UInt8
                        byte month)
                 throws IllegalArgumentException

      Set the month component of the date, which is in the range 1 to 12.

      Parameters:
        `month` - Month component of the date.
      Throws:
        `IllegalArgumentException` - Provided month value is outside the acceptable range.

    - #### getYear

          @Int16
          short getYear()

      Returns the year component of the date.

      Returns:
        Year part of the date.

    - #### setYear

          void setYear(@Int16
                       short year)
                throws IllegalArgumentException

      Sets the year component of the date, in the range -9999 to 9999.

      Parameters:
        `year` - Year component of the date.
      Throws:
        `IllegalArgumentException` - Year is outside the acceptable range.

    - #### getDateValue

          Calendar getDateValue()

      Returns a `Calendar` value representing the date represented by this value.

      Returns:
        Java Calendar representation of this date structure, to the current default timezone and locale settings.

    - #### clone

          DateStruct clone()

      Create a cloned copy of this date value.

      Returns:
        Cloned copy of this date value.

    - #### toString

          String toString()

      Formats the date value as a UTC date-only value. The format is "`yyyy-mm-dd`", the year followed by the month followed by the day of the month. Note that locale and timezone are not available in a date structure.

      Overrides:
        `toString` in class `Object`
      Returns:
        Date value formatted as a UTC-style string without a timezone.
      See Also:
        `Forge.parseDate(String)`

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.