VMime
datetimeUtils Class Reference

Static Public Member Functions

static bool isLeapYear (const int year)
 
static int getDaysInMonth (const int year, const int month)
 
static const datetime toUniversalTime (const datetime &date)
 
static const datetime toLocalTime (const datetime &date, const int zone)
 
static int getDayOfWeek (const int year, const int month, const int day)
 
static int getWeekOfYear (const int year, const int month, const int day, const bool iso=false)
 

Detailed Description

Miscellaneous functions related to date/time.

Member Function Documentation

int getDayOfWeek ( const int  year,
const int  month,
const int  day 
)
static

Return the day of the week from the specified date.

Parameters
yearyear in 4-digit format
monthmonth (1-12), January is 1, December is 12 (see datetime::Months enum)
daymonth day (1-31)
Returns
the day of the week, Sunday is 0, Monday is 1 (see datetime::DaysOfWeek enum)

References datetimeUtils::getDaysInMonth().

Referenced by datetime::getWeekDay().

int getDaysInMonth ( const int  year,
const int  month 
)
static

Return the number of days in the specified month.

Parameters
yearyear in 4-digit format (this is needed to check for leap years)
monthmonth, January is 1, December is 12 (see datetime::Months enum)
Returns
the number of days in the month

References datetimeUtils::isLeapYear().

Referenced by datetimeUtils::getDayOfWeek().

int getWeekOfYear ( const int  year,
const int  month,
const int  day,
const bool  iso = false 
)
static

Return the week number in the year (ISO 8601).

Parameters
yearyear in 4-digit format
monthmonth (1-12), January is 1, December is 12 (see datetime::Months enum)
daymonth day (1-31)
isoif TRUE, use ISO week-numbering year (default is to use calendar year). For more information, read here: http://en.wikipedia.org/wiki/ISO_8601#Week_dates
Returns
the week number (1 is the first week of the year)

Referenced by datetime::getWeek().

bool isLeapYear ( const int  year)
static

Test whether the specified year is a leap year.

Parameters
yearyear in 4-digit format
Returns
true if year is a leap year, false otherwise

Referenced by datetimeUtils::getDaysInMonth().

const datetime toLocalTime ( const datetime date,
const int  zone 
)
static

Convert the specified date/time to the specified time zone.

Parameters
datedate/time to convert
zonelocal zone to convert to (see datetime::TimeZones enum)
Returns
local time and date

References datetime::getZone(), datetime::GMT, datetime::setZone(), and datetimeUtils::toUniversalTime().

const datetime toUniversalTime ( const datetime date)
static

Convert the specified date/time to UT (GMT).

Parameters
datedate/time to convert
Returns
GMT date/time

References datetime::getZone(), datetime::GMT, and datetime::setZone().

Referenced by datetime::operator!=(), datetime::operator<(), datetime::operator<=(), datetime::operator==(), datetime::operator>(), datetime::operator>=(), and datetimeUtils::toLocalTime().


The documentation for this class was generated from the following files: