Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.property
Interface DateTimeFactory

All Superinterfaces:
  ValueFactory<DateTime>

    public interface DateTimeFactory

extends ValueFactory<DateTime>

A factory for creating `date-time instants`. This interface extends the `ValueFactory` generic interface and adds specific methods for creating instants for the current time (and time zone) as well as various combinations of individual field values.

## ISO-8601

The factory creates date-time instants from strings that are in the standard ISO-8601 format. There are three supported styles: month-based, day-of-year-based, and week-based.

### Month-Based

The month-based representation is the most common format of ISO8601, and is the format used in the XML standards for passing dates and times:

     yyyy-mm-ddTHH:MM:SS.SSSZ

The fields are separated by dashes and consist of:

- four digit year;
- two digit month, where 01 is Janurary and 12 is December;
- two digit day of month, from 01 to 31;
- two digit hour, from 00 to 23;
- two digit minute, from 00 to 59;
- two digit second, from 00 to 59;
- three decimal places for milliseconds, if required;
- time zone offset of the form `�HH:mm` (or '0' if UTC)

### Day of Year Based

This format of ISO-8601 uses a single field to represent the day of the year:

     yyyy-dddTHH:MM:SS.SSSZ

The fields are separated by dashes and consist of:

- four digit year
- three digit day of year, from 001 to 366;
- two digit hour, from 00 to 23;
- two digit minute, from 00 to 59;
- two digit second, from 00 to 59;
- three decimal places for milliseconds, if required;
- time zone offset of the form `�HH:mm` (or '0' if UTC)

### Week Based

This format of ISO-8601 uses a single field to represent the day of the year:

     yyyy-Www-dTHH:MM:SS.SSSZ

The fields are separated by dashes and consist of:

- four digit weekyear (see below)
- two digit week of year, from 01 to 53;
- one digit day of week, from 1 to 7 where 1 is Monday and 7 is Sunday;
- two digit hour, from 00 to 23;
- two digit minute, from 00 to 59;
- two digit second, from 00 to 59;
- three decimal places for milliseconds, if required;
- time zone offset of the form `�HH:mm` (or '0' if UTC)

From Joda-Time: Weeks are always complete, and the first week of a year is the one that includes the first Thursday of the year. This definition can mean that the first week of a year starts in the previous year, and the last week finishes in the next year. The weekyear field is defined to refer to the year that owns the week, which may differ from the actual year.

Field Summary

Fields inherited from interface org.modeshape.graph.property.ValueFactory
`DEFAULT_DECODER, DEFAULT_ENCODER`

Method Summary
`DateTime` | `create()` Create a date-time instance for the current time in the local time zone.
`DateTime` | `create(DateTime original, long offsetInMillis)` Create a date-time instance that is offset from the original by the specified amount.
`DateTime` | `create(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisecondsOfSecond)` Create a date-time instance given the individual values for the fields
`DateTime` | `create(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisecondsOfSecond, int timeZoneOffsetHours)` Create a date-time instance given the individual values for the fields
`DateTime` | `create(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisecondsOfSecond, String timeZoneId)` Create a date-time instance given the individual values for the fields
`DateTime` | `createUtc()` Create a date-time instance for the current time in UTC.

Methods inherited from interface org.modeshape.graph.property.ValueFactory
`create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, create, getPropertyType`

Method Detail

### create

    DateTime create()

  Create a date-time instance for the current time in the local time zone.

  Returns:
    the current date-time instance
  See Also:
    `createUtc()`

### createUtc

    DateTime createUtc()

  Create a date-time instance for the current time in UTC.

  Returns:
    the current date-time instance (in UTC)
  See Also:
    `create()`

### create

    DateTime create(DateTime original,
                    long offsetInMillis)

  Create a date-time instance that is offset from the original by the specified amount.

  Parameters:
    `original` -
    `offsetInMillis` - the offset in milliseconds (positive or negative)
  Returns:
    the offset date-time instance

### create

    DateTime create(int year,
                    int monthOfYear,
                    int dayOfMonth,
                    int hourOfDay,
                    int minuteOfHour,
                    int secondOfMinute,
                    int millisecondsOfSecond)

  Create a date-time instance given the individual values for the fields

  Parameters:
    `year` - the year of the era
    `monthOfYear` - the month of the year
    `dayOfMonth` - the day of the month
    `hourOfDay` - the hour of the day
    `minuteOfHour` - the minute of the hour
    `secondOfMinute` - the second of the minute
    `millisecondsOfSecond` - the milliseconds of the second
  Returns:
    the date-time instance

### create

    DateTime create(int year,
                    int monthOfYear,
                    int dayOfMonth,
                    int hourOfDay,
                    int minuteOfHour,
                    int secondOfMinute,
                    int millisecondsOfSecond,
                    int timeZoneOffsetHours)

  Create a date-time instance given the individual values for the fields

  Parameters:
    `year` - the year of the era
    `monthOfYear` - the month of the year
    `dayOfMonth` - the day of the month
    `hourOfDay` - the hour of the day
    `minuteOfHour` - the minute of the hour
    `secondOfMinute` - the second of the minute
    `millisecondsOfSecond` - the milliseconds of the second
    `timeZoneOffsetHours` - the number of hours offset from UTC for the time zone
  Returns:
    the date-time instance

### create

    DateTime create(int year,
                    int monthOfYear,
                    int dayOfMonth,
                    int hourOfDay,
                    int minuteOfHour,
                    int secondOfMinute,
                    int millisecondsOfSecond,
                    String timeZoneId)

  Create a date-time instance given the individual values for the fields

  Parameters:
    `year` - the year of the era
    `monthOfYear` - the month of the year
    `dayOfMonth` - the day of the month
    `hourOfDay` - the hour of the day
    `minuteOfHour` - the minute of the hour
    `secondOfMinute` - the second of the minute
    `millisecondsOfSecond` - the milliseconds of the second
    `timeZoneId` - the ID of the time zone (e.g, "PST", "UTC", "EDT"); may not be null
  Returns:
    the date-time instance

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.