Package smjg.libs.util.datetime

Date and time manipulation. More...


Classes

struct  DateValue
 The smjg.libs.util.datetime.DateValue structure represents a calendar date. More...
struct  TimeValue
 The smjg.libs.util.datetime.TimeValue structure represents a time within a day. More...
struct  DateTime
 The smjg.libs.util.datetime.DateTime structure represents a combination of date and time. More...
struct  DateTimeInterval
 The smjg.libs.util.datetime.DateTimeInterval structure represents an interval in both date and time. More...
class  DateTimeException
 The smjg.libs.util.datetime.DateTimeException class is an exception thrown when a date/time operation fails, e.g. More...
struct  DateTimeComponents
 The smjg.libs.util.datetime.DateTimeComponents structure represents a date and time in structured form. More...

Typedefs

typedef int DateInterval
 The smjg.libs.util.datetime.DateInterval type represents an interval between date values, specified in days.
typedef int TimeInterval
 The smjg.libs.util.datetime.TimeInterval type represents an interval between time values, specified in milliseconds.

Enumerations

enum  DAY_OF_WEEK {
  UNSPEC = byte.min, SUN = 0,
  MON, TUE,
  WED, THU,
  FRI, SAT
}
 Constants representing the days of the week. More...
enum  MONTH {
  UNSPEC = byte.min, JAN = 1,
  FEB, MAR,
  APR, MAY,
  JUN, JUL,
  AUG, SEP,
  OCT, NOV,
  DEC
}
 Constants representing the months of the year. More...

Functions

bool isLeapYear (int year)
 Determines whether the given year is a leap year.
int GetDateFormatA (uint Locale, DWORD dwFlags, SYSTEMTIME *lpDate, LPCSTR lpFormat, LPSTR lpDateStr, int cchDate)
int GetTimeFormatA (uint Locale, DWORD dwFlags, SYSTEMTIME *lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, int cchTime)
int monthLength (int month, int year)
 Determines the length of a month.
return MONTH_OFFSET (month< 3 &&isLeapYear(year))

Variables

const char[3][MONTH.max+1] SHORT_DAY_NAME
 Short (three-letter) names of the days of the week.
const char[][MONTH.max+1] LONG_DAY_NAME
 Full names of the days of the week.
const char[3][MONTH.max+1] SHORT_MONTH_NAME
 Short (three-letter) names of the months of the year.
const char[][MONTH.max+1] LONG_MONTH_NAME
 Full names of the months of the year.
const int MONTH_LEN [MONTH.max+1]
 The length of each month in a common year.
int timeZoneOffset
 The local time zone offset from UTC in minutes.
bool allowFieldOverflow = false
 Whether to allow alignment fields to overflow.


Detailed Description

Date and time manipulation.

The smjg.libs.util.datetime module provides an object-oriented means of manipulating dates and times.

Todo:
Support interrogation of current date/time and time zone on Linux and other platforms. Add more features (see readme).

Typedef Documentation

typedef int smjg::libs::util::datetime.DateInterval

The smjg.libs.util.datetime.DateInterval type represents an interval between date values, specified in days.

Status:
experimental
Warning:
It will not work to mix DateInterval and TimeInterval directly in arithmetic operations. Trying to do so will yield strange results, which seem to be due to an apparent bug in DMD's treatment of mixed typedef expressions.

typedef int smjg::libs::util::datetime.TimeInterval

The smjg.libs.util.datetime.TimeInterval type represents an interval between time values, specified in milliseconds.

Status:
experimental
Warning:
It will not work to mix DateInterval and TimeInterval directly in arithmetic operations. Trying to do so will yield strange results, which seem to be due to an apparent bug in DMD's treatment of mixed typedef expressions.


Enumeration Type Documentation

enum smjg::libs::util::datetime::DAY_OF_WEEK

Constants representing the days of the week.

Enumerator:
UNSPEC 
SUN 
MON 
TUE 
WED 
THU 
FRI 
SAT 

enum smjg::libs::util::datetime::MONTH

Constants representing the months of the year.

Enumerator:
UNSPEC 
JAN 
FEB 
MAR 
APR 
MAY 
JUN 
JUL 
AUG 
SEP 
OCT 
NOV 
DEC 


Function Documentation

int smjg.libs.util.datetime.GetDateFormatA ( uint  Locale,
DWORD  dwFlags,
SYSTEMTIME *  lpDate,
LPCSTR  lpFormat,
LPSTR  lpDateStr,
int  cchDate 
)

int smjg.libs.util.datetime.GetTimeFormatA ( uint  Locale,
DWORD  dwFlags,
SYSTEMTIME *  lpTime,
LPCSTR  lpFormat,
LPSTR  lpTimeStr,
int  cchTime 
)

bool smjg.libs.util.datetime.isLeapYear ( int  year  ) 

Determines whether the given year is a leap year.

Parameters:
year year to check.
Return values:
true if the year is a leap year.
false if the year is a common year.

return smjg.libs.util.datetime.MONTH_OFFSET (  ) 

int smjg.libs.util.datetime.monthLength ( int  month,
int  year 
)

Determines the length of a month.

Parameters:
month month whose length is to be found.
year year in which the month occurs.
Returns:
the length of the given month in days.


Variable Documentation

bool smjg::libs::util::datetime.allowFieldOverflow = false

Whether to allow alignment fields to overflow.

If this is false, a DateTimeFormatException will be thrown if the formatted content of a field exceeds the field's specified width.

const char [][MONTH.max + 1] smjg::libs::util::datetime.LONG_DAY_NAME

Initial value:

 [
       DAY_OF_WEEK.SUN: "Sunday", "Monday", "Tuesday", "Wednesday",
         "Thursday", "Friday", "Saturday"
]
Full names of the days of the week.

const char [][MONTH.max + 1] smjg::libs::util::datetime.LONG_MONTH_NAME

Initial value:

 [
       null, MONTH.JAN: "January", "February", "March", "April", "May", "June",
       "July", "August", "September", "October", "November", "December"
]
Full names of the months of the year.

const int smjg::libs::util::datetime.MONTH_LEN[MONTH.max+1]

Initial value:

 [
       MONTH.JAN: 31, MONTH.FEB: 28, MONTH.MAR: 31, MONTH.APR: 30,
       MONTH.MAY: 31, MONTH.JUN: 30, MONTH.JUL: 31, MONTH.AUG: 31,
       MONTH.SEP: 30, MONTH.OCT: 31, MONTH.NOV: 30, MONTH.DEC: 31
]
The length of each month in a common year.

const char [3][MONTH.max + 1] smjg::libs::util::datetime.SHORT_DAY_NAME

Initial value:

 [
       DAY_OF_WEEK.SUN: "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
]
Short (three-letter) names of the days of the week.

const char [3][MONTH.max + 1] smjg::libs::util::datetime.SHORT_MONTH_NAME

Initial value:

 [
       ['\xFF', '\xFF', '\xFF'],
       MONTH.JAN: "Jan", "Feb", "Mar", "Apr", "May", "Jun",
       "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
]
Short (three-letter) names of the months of the year.

int smjg::libs::util::datetime.timeZoneOffset

The local time zone offset from UTC in minutes.

A positive value indicates a zone ahead of UTC; a negative value behind. Under Windows, this is automatically initialised to the system time zone.

Todo:
Implement initialisation on platforms other than Windows.


Generated on Sun Sep 13 19:50:35 2009 for Stewart's Utility Library by  doxygen 1.5.4