smjg.libs.util.datetime.DateValue Struct Reference

The smjg.libs.util.datetime.DateValue structure represents a calendar date. More...

List of all members.

Operators

typedef opSub opCmp
DateValue opAdd (int i)
 Adds the given interval in days to this date.
DateValue opSub (int i)
 Subtracts the given interval in days from this date.
DateInterval opSub (DateValue d)
 Calculates the interval in days between this date and another date.
DateValue opAddAssign (int i)
 Adds the given interval in days to this date.
DateValue opSubAssign (int i)
 Subtracts the given interval in days from this date.

Public Types

enum  {
  YEAR = 365, YEAR_4 = YEAR * 4 + 1,
  YEAR_100 = YEAR_4 * 25 - 1, YEAR_400 = YEAR_100 * 4 + 1
}
 Constants representing the numbers of days in certain units of time significant to the Gregorian calendar. More...

Public Member Functions

DateValue nearest (DAY_OF_WEEK w)
 Calculates the nearest occurrence of the given day of the week to this date.
string format (cstring formatString)
 Formats this date according to a format string.
Properties
int year ()
MONTH month ()
int day ()
DAY_OF_WEEK dayOfWeek ()
string toString ()
 Returns a string representation of this date.
char[] toFormatString (uint flags=1)
 Formats this date according to the OS-defined format.
char[] toShortFormatString ()
 Formats this date according to the OS-defined short format.
char[] toLongFormatString ()
 Formats this date according to the OS-defined long format.

Static Public Member Functions

static DateValue now ()
 Retrieves the current system date.
Pseudo-constructors
static DateValue opCall (int day)
 Constructs a DateValue with the given dayNo value.
static DateValue opCall (int year, int month, int day)
 Constructs a DateValue representing the given date.

Public Attributes

int dayNo = int.min
 The internal numerical representation of the date, in days from 1 January 1BC (as it would be defined in the Gregorian calendar).


Detailed Description

The smjg.libs.util.datetime.DateValue structure represents a calendar date.


Member Typedef Documentation

typedef opSub smjg.libs.util.datetime.DateValue.opCmp


Member Enumeration Documentation

anonymous enum

Constants representing the numbers of days in certain units of time significant to the Gregorian calendar.

Enumerator:
YEAR  a common (non-leap) year
YEAR_4  a period of four years, assumed not to cross a century boundary
YEAR_100  a century, assumed not to cross a 400-year boundary
YEAR_400  a period of 400 years.


Member Function Documentation

static DateValue smjg.libs.util.datetime.DateValue.opCall ( int  day  )  [static]

Constructs a DateValue with the given dayNo value.

static DateValue smjg.libs.util.datetime.DateValue.opCall ( int  year,
int  month,
int  day 
) [static]

Constructs a DateValue representing the given date.

Parameters:
year the year.
month the month, from 1 (January) to 12 (December). A MONTH value can be used.
day the day of the month.
Exceptions:
DateTimeException if month or day is out of range.
Bug:
will not work with dates before 1BC

static DateValue smjg.libs.util.datetime.DateValue.now (  )  [static]

Retrieves the current system date.

Bug:
Always gets the date in the system time zone, even if timeZoneOffset has been overridden.
Todo:
Implement on platforms other than Windows.

DateValue smjg.libs.util.datetime.DateValue.nearest ( DAY_OF_WEEK  w  ) 

Calculates the nearest occurrence of the given day of the week to this date.

string smjg.libs.util.datetime.DateValue.format ( cstring  formatString  ) 

Formats this date according to a format string.

Parameters:
formatString the format string, as defined in smjg.libs.util.datetimeformat.
Returns:
the formatted date string.
Exceptions:
DateTimeFormatException if the formatting fails, e.g. because of an error in the format string.

int smjg.libs.util.datetime.DateValue.year (  ) 

MONTH smjg.libs.util.datetime.DateValue.month (  ) 

int smjg.libs.util.datetime.DateValue.day (  ) 

DAY_OF_WEEK smjg.libs.util.datetime.DateValue.dayOfWeek (  ) 

string smjg.libs.util.datetime.DateValue.toString (  ) 

Returns a string representation of this date.

Returns:
a string representation in the form e.g. "Sat 8 May 2004".

char [] smjg.libs.util.datetime.DateValue.toFormatString ( uint  flags = 1  ) 

Formats this date according to the OS-defined format.

Parameters:
flags a value to pass to the OS date-formatting API determining how to format the date.
Returns:
a string representation of this date in the OS-defined format.
Todo:
Implement on platforms other than Windows.

char [] smjg.libs.util.datetime.DateValue.toShortFormatString (  ) 

Formats this date according to the OS-defined short format.

Returns:
a string representation of the date in the OS-defined short format.
Todo:
Implement on platforms other than Windows.

char [] smjg.libs.util.datetime.DateValue.toLongFormatString (  ) 

Formats this date according to the OS-defined long format.

Returns:
a string representation of the date in the OS-defined long format.
Todo:
Implement on platforms other than Windows.

DateValue smjg.libs.util.datetime.DateValue.opAdd ( int  i  ) 

Adds the given interval in days to this date.

DateValue smjg.libs.util.datetime.DateValue.opSub ( int  i  ) 

Subtracts the given interval in days from this date.

DateInterval smjg.libs.util.datetime.DateValue.opSub ( DateValue  d  ) 

Calculates the interval in days between this date and another date.

DateValue smjg.libs.util.datetime.DateValue.opAddAssign ( int  i  ) 

Adds the given interval in days to this date.

DateValue smjg.libs.util.datetime.DateValue.opSubAssign ( int  i  ) 

Subtracts the given interval in days from this date.


Member Data Documentation

int smjg.libs.util.datetime.DateValue.dayNo = int.min

The internal numerical representation of the date, in days from 1 January 1BC (as it would be defined in the Gregorian calendar).

A value of int.min denotes an invalid or null date.


The documentation for this struct was generated from the following file:
Generated on Sun Sep 13 19:50:35 2009 for Stewart's Utility Library by  doxygen 1.5.4