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:

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:

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:

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


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