In file DODS_Date_Time.h:

class DODS_Date_Time

The DODS Date/Time class is used to represent and compute with combined date and time values

Public Methods

double get_epsilon() const
Get the value of epsilon used for equality tests of time
void set_epsilon(double eps)
Set the value of epsilon used for equality tests of time
bool OK() const
Class invariant

Public

Constructors
DODS_Date_Time()
Create an empty instance
DODS_Date_Time(DODS_Date d, DODS_Time t)
Create an instance using DODS\_Date and DODS\_Time objects
DODS_Date_Time(String date_time)
Create an instance using the string representation of a DODS\_Date\_Time
DODS_Date_Time(BaseType *date_time)
Create an instance using the string representation of a DODS\_Date\_Time contained in a DODS Str
DODS_Date_Time(int y, int m, int d, int hh, int mm = 0, double ss = 0.0, bool gmt = false)
Create an instance using numeric values for the year,
DODS_Date_Time(int y, int yd, int hh, int mm = 0, double ss = 0.0, bool gmt = false)
Create an instance using numeric values for the year,
Assignment
void set(DODS_Date d, DODS_Time t)
Set an instance using DODS\_Date and DODS\_Time objects
void set(String date_time)
Set an instance using the string representation of a DODS\_Date\_Time
void set(BaseType *date_time)
Set an instance using the string representation of a DODS\_Date\_Time contained in a DODS Str
void set(int y, int m, int d, int hh, int mm = 0, double ss = 0.0, bool gmt = false)
Set an instance using numeric values for the year,
void set(int y, int yd, int hh, int mm = 0, double ss = 0.0, bool gmt = false)
Set an instance using numeric values for the year,
Access
int year() const
int month() const
int day() const
int day_number() const
int hours() const
int minutes() const
double seconds() const
bool gmt() const
String get(date_format format = ymd, bool gmt = true) const
Get the string representation of the date/time
double julian_day() const
time_t unix_time() const
Return the number of seconds since 00:00:00 UTC 1 Jan 1970
Relational operators
friend int operator==(DODS_Date_Time &t1, DODS_Date_Time &t2)
Equality
friend int operator!=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Inequality
friend int operator<(DODS_Date_Time &t1, DODS_Date_Time &t2)
Less-than
friend int operator>(DODS_Date_Time &t1, DODS_Date_Time &t2)
Greater-than
friend int operator<=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Less-than or Equal-to
friend int operator>=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Greater-than or Equal-to

Documentation

The DODS Date/Time class is used to represent and compute with combined date and time values.
Constructors

DODS_Date_Time()
Create an empty instance. Will not pass the class invariant.

DODS_Date_Time(DODS_Date d, DODS_Time t)
Create an instance using DODS\_Date and DODS\_Time objects.
Parameters:
d - A DODS\_Date object.
t - A DODS\_Time object.

DODS_Date_Time(String date_time)
Create an instance using the string representation of a DODS\_Date\_Time.
Parameters:
date_time - The date/time string.

DODS_Date_Time(BaseType *date_time)
Create an instance using the string representation of a DODS\_Date\_Time contained in a DODS Str.
Parameters:
date_time - The date/time string (in a DODS Str pointer).

DODS_Date_Time(int y, int m, int d, int hh, int mm = 0, double ss = 0.0, bool gmt = false)
Create an instance using numeric values for the year, ..., seconds.
Parameters:
y - The year number, 1 is 1 A.D.
m - The month, 1 is January, ..., 12 is December.
d - The day.
hh - The hour, 0...23.
mm - The minute, 0...59.
ss - The seconds, 0.0, ..., 59.999...
gmt - True if the time is a GMT time, false otherwise.

DODS_Date_Time(int y, int yd, int hh, int mm = 0, double ss = 0.0, bool gmt = false)
Create an instance using numeric values for the year, ..., seconds.
Parameters:
y - The year number, 1 is 1 A.D.
yd - The year-day, 1 is 1 January, 365/366 is 31 December.
hh - The hour, 0...23.
mm - The minute, 0...59.
ss - The seconds, 0.0, ..., 59.999...
gmt - True if the time is a GMT time, false otherwise.

Assignment

void set(DODS_Date d, DODS_Time t)
Set an instance using DODS\_Date and DODS\_Time objects.
Parameters:
d - A DODS\_Date object.
t - A DODS\_Time object.

void set(String date_time)
Set an instance using the string representation of a DODS\_Date\_Time.
Parameters:
date_time - The date/time string.

void set(BaseType *date_time)
Set an instance using the string representation of a DODS\_Date\_Time contained in a DODS Str.
Parameters:
date_time - The date/time string (in a DODS Str pointer).

void set(int y, int m, int d, int hh, int mm = 0, double ss = 0.0, bool gmt = false)
Set an instance using numeric values for the year, ..., seconds.
Parameters:
y - The year number, 1 is 1 A.D.
m - The month, 1 is January, ..., 12 is December.
d - The day.
hh - The hour, 0...23.
mm - The minute, 0...59.
ss - The seconds, 0.0, ..., 59.999...
gmt - True if the time is a GMT time, false otherwise.

void set(int y, int yd, int hh, int mm = 0, double ss = 0.0, bool gmt = false)
Set an instance using numeric values for the year, ..., seconds.
Parameters:
y - The year number, 1 is 1 A.D.
yd - The year-day, 1 is 1 January, 365/366 is 31 December.
hh - The hour, 0...23.
mm - The minute, 0...59.
ss - The seconds, 0.0, ..., 59.999...
gmt - True if the time is a GMT time, false otherwise.

Access

int year() const
Returns:
The year in years A.D.

int month() const
Returns:
The month of the year (1 == January, ..., 12 == December).

int day() const
Returns:
The day of the month (1, ... {28, 29, 30, 31}.

int day_number() const
Returns:
The day-number of the year (1 = 1 Jan).

int hours() const
Returns:
The number of hours.

int minutes() const
Returns:
The number of minutes.

double seconds() const
Returns:
The number of seconds.

bool gmt() const
Returns:
True if the time is a GMT time, false otherwise.

String get(date_format format = ymd, bool gmt = true) const
Get the string representation of the date/time. If #format# is #ymd#, return the date-time using yyyy/mm/dd:hh:mm:ss notation, if it is #yd#, use yyyy/ddd... notation. If #gmt# is true, append GMT to times that are GMT times, if false, don't (ever) append the GMT suffix.
Returns:
The string representation f the date-time.
Parameters:
format - The format of the date-part.
gmt - Append the GMT suffix to GMT times.

double julian_day() const
Returns:
The Julian day number for this date and time. The time part of the day is represented as a fraction.

time_t unix_time() const
Return the number of seconds since 00:00:00 UTC 1 Jan 1970. If the date is before 1 Jan 1970, return DODS\_UINT\_MAX. If the date is too late to represent as seconds since 1 Jan 1970, return DODS\_UINT\_MAX. Each day starts at 00:00:00 UTC.
Returns:
The date in seconds since 1 Jan 1970.
See Also:
dods-limits.h
time.h
mktime(3)

Relational operators

friend int operator==(DODS_Date_Time &t1, DODS_Date_Time &t2)
Equality

friend int operator!=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Inequality

friend int operator<(DODS_Date_Time &t1, DODS_Date_Time &t2)
Less-than

friend int operator>(DODS_Date_Time &t1, DODS_Date_Time &t2)
Greater-than

friend int operator<=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Less-than or Equal-to

friend int operator>=(DODS_Date_Time &t1, DODS_Date_Time &t2)
Greater-than or Equal-to

double get_epsilon() const
Get the value of epsilon used for equality tests of time

void set_epsilon(double eps)
Set the value of epsilon used for equality tests of time. By default the value is 0.000001 (10e-6). NB: This should rarely be changed.

bool OK() const
Class invariant.
Returns:
True if the instance is valid, false otherwise.


This class has no child classes.
Author:
James Gallagher
See Also:
DODS_Date
DODS_Time

alphabetic index hierarchy of classes


generated by doc++