|
OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
|
The DODS Date object. More...
#include <DODS_Date.h>

Public Member Functions | |
| int | day () const |
| ). More... | |
| int | day_number () const |
| DODS_Date (int year, int month, int day) | |
| DODS_Date (int year, int month, int day, date_format format) | |
| date_format | format () const |
| double | fraction () const |
| long | julian_day () const |
| bool | OK () const |
| Class invariant. More... | |
| time_t | unix_time () const |
| Return the number of seconds since 00:00:00 UTC 1 Jan 1970. More... | |
Constructors | |
| DODS_Date () | |
| Create an empty date. More... | |
| DODS_Date (string date_str) | |
| Build a DODS_Date by parsing the string #date_str#. More... | |
| DODS_Date (BaseType *arg) | |
| Build a DODS_Date by parsing the DODS string contained in #arg#. More... | |
| DODS_Date (int year, int day_num) | |
| Build a DODS_Date using year and day-number values. More... | |
Assignment | |
| void | set (string date) |
| Parse the string and assign the value to this object. More... | |
| void | set (BaseType *arg) |
| Parse the DODS string and assign the value to this object. More... | |
| void | set (int year, int day_number) |
| Assign the date using the two integers. More... | |
| void | set (int year, int month, int day) |
| Assign the date using three integers. More... | |
| void | set (int year, int month, int day, date_format format) |
| Assign the date using three integers and a date_format enumeration. More... | |
Access | |
| string | get (date_format format=ymd) const |
| Get the string representation for this date. More... | |
| int | year () const |
| int | month () const |
Friends | |
Relational operators | |
| int | operator== (DODS_Date &d1, DODS_Date &d2) |
| Equality. More... | |
| int | operator!= (DODS_Date &d1, DODS_Date &d2) |
| Inequality. More... | |
| int | operator< (DODS_Date &d1, DODS_Date &d2) |
| Less than. More... | |
| int | operator> (DODS_Date &d1, DODS_Date &d2) |
| Greater than. More... | |
| int | operator<= (DODS_Date &d1, DODS_Date &d2) |
| Less than or equal. More... | |
| int | operator>= (DODS_Date &d1, DODS_Date &d2) |
| Greater than or equal. More... | |
The DODS Date object.
This provides a way to translate between local representations of dates and the DODS standard representation(s). The DODS_Date object provides constructors, accessors and comparison operations; DODS servers which support the DODS standard representation of dates must implement CE functions that make use of this object.
Definition at line 108 of file DODS_Date.h.
| DODS_Date::DODS_Date | ( | ) |
Create an empty date.
Set the date using one of the #set_date# mfuncs.
Definition at line 95 of file DODS_Date.cc.
| DODS_Date::DODS_Date | ( | string | date_str | ) |
Build a DODS_Date by parsing the string #date_str#.
If #date_str# is of the form `yyyy/ddd' assume that it is in year and day-number format. If it is of the form `yyyy/mm/dd' assume it is in year, month and day format. Note that if `yyyy' is `98' that means year 98 A.D., not 1998.
| date_str | A string containing the date. |
| DODS_Date::DODS_Date | ( | BaseType * | arg | ) |
Build a DODS_Date by parsing the DODS string contained in #arg#.
Throws Error if #arg# is not a DODS Str object.
| arg | A DODS string containing the date. |
Definition at line 100 of file DODS_Date.cc.
References set().

| DODS_Date::DODS_Date | ( | int | year, |
| int | day_num | ||
| ) |
Build a DODS_Date using year and day-number values.
This constructor assumes that the two integers are the year and day-number, respectively.
| year | The year. `98' is 98 A.D., not 1998. |
| day_num | The day-number, 1 Jan is day 1. |
Definition at line 111 of file DODS_Date.cc.
References set().

| DODS_Date::DODS_Date | ( | int | year, |
| int | month, | ||
| int | day | ||
| ) |
Definition at line 116 of file DODS_Date.cc.
References set().

| DODS_Date::DODS_Date | ( | int | year, |
| int | month, | ||
| int | day, | ||
| date_format | format | ||
| ) |
Definition at line 121 of file DODS_Date.cc.
References set().

| int DODS_Date::day | ( | ) | const |
).
Definition at line 402 of file DODS_Date.cc.
Referenced by DODS_Date_Time::day(), set(), and DODS_Date_Time::unix_time().
| int DODS_Date::day_number | ( | ) | const |
Definition at line 407 of file DODS_Date.cc.
Referenced by DODS_Date_Time::day_number().
| date_format DODS_Date::format | ( | ) | const |
Definition at line 419 of file DODS_Date.cc.
Referenced by operator<=(), operator==(), operator>=(), and set().
| double DODS_Date::fraction | ( | ) | const |
Definition at line 424 of file DODS_Date.cc.
References days_in_year().
Referenced by DODS_Date_Time::get(), and get().

| string DODS_Date::get | ( | date_format | format = ymd | ) | const |
Get the string representation for this date.
By default the y/m/d format is used. To get the year/year-day format use yd# for the value of format#.
Throws Error if format# is not ymd# or yd#.
| format | The format of the date. |
Definition at line 429 of file DODS_Date.cc.
References assert, decimal, fraction(), iso8601, yd, ym, and ymd.
Referenced by DODS_Date_Time::get().

| long DODS_Date::julian_day | ( | ) | const |
Definition at line 412 of file DODS_Date.cc.
Referenced by DODS_Date_Time::julian_day(), and set().
| int DODS_Date::month | ( | ) | const |
Definition at line 397 of file DODS_Date.cc.
Referenced by DODS_Date_Time::month(), operator<=(), operator==(), operator>=(), set(), and DODS_Date_Time::unix_time().
| bool DODS_Date::OK | ( | ) | const |
Class invariant.
Definition at line 88 of file DODS_Date.cc.
References unknown_format.
Referenced by set().
| void DODS_Date::set | ( | string | date | ) |
Parse the string and assign the value to this object.
Referenced by DODS_Date(), DODS_Date_Time::set(), and set().
| void DODS_Date::set | ( | BaseType * | arg | ) |
Parse the DODS string and assign the value to this object.
Definition at line 126 of file DODS_Date.cc.
References set().

| void DODS_Date::set | ( | int | year, |
| int | day_number | ||
| ) |
Assign the date using the two integers.
Definition at line 312 of file DODS_Date.cc.
References assert, days_to_month_day(), julian_day(), OK(), yd, and year().

| void DODS_Date::set | ( | int | year, |
| int | month, | ||
| int | day | ||
| ) |
Assign the date using three integers.
Definition at line 324 of file DODS_Date.cc.
References assert, day(), julian_day(), month(), month_day_to_days(), OK(), year(), and ymd.

| void DODS_Date::set | ( | int | year, |
| int | month, | ||
| int | day, | ||
| date_format | format | ||
| ) |
Assign the date using three integers and a date_format enumeration.
Definition at line 337 of file DODS_Date.cc.
References assert, day(), format(), julian_day(), month(), month_day_to_days(), OK(), and year().

| time_t DODS_Date::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.
Definition at line 463 of file DODS_Date.cc.
| int DODS_Date::year | ( | ) | const |
Definition at line 392 of file DODS_Date.cc.
Referenced by DODS_Date_Time::get(), operator<=(), operator==(), operator>=(), set(), DODS_Date_Time::unix_time(), and DODS_Date_Time::year().
Inequality.
Definition at line 360 of file DODS_Date.cc.
Less than.
Definition at line 365 of file DODS_Date.cc.
Less than or equal.
Definition at line 375 of file DODS_Date.cc.
Equality.
Definition at line 349 of file DODS_Date.cc.
Greater than.
Definition at line 370 of file DODS_Date.cc.
Greater than or equal.
Definition at line 383 of file DODS_Date.cc.