OCILIB (C and C++ Driver for Oracle)
4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
|
Object identifying the SQL data type DATE. More...
#include <types.hpp>
Inherits ocilib::core::HandleHolder< OCI_Date * >, and ocilib::core::Streamable.
Public Member Functions | |
Date (bool create=false) | |
Create an empty null Date object. | |
Date (const otext *str, const otext *format=OTEXT("")) | |
Create a date object with the value provided by the input date time string. | |
Date (const ostring &str, const ostring &format=OTEXT("")) | |
Create a date object with the value provided by the input date time string. | |
bool | IsValid () const |
Check if the given date is valid. | |
int | GetYear () const |
Return the date year value. | |
void | SetYear (int value) |
Set the date year value. | |
int | GetMonth () const |
Return the date month value. | |
void | SetMonth (int value) |
Set the date month value. | |
int | GetDay () const |
Return the date day value. | |
void | SetDay (int value) |
Set the date day value. | |
int | GetHours () const |
Return the date hours value. | |
void | SetHours (int value) |
Set the date hours value. | |
int | GetMinutes () const |
Return the date minutes value. | |
void | SetMinutes (int value) |
Set the date minutes value. | |
int | GetSeconds () const |
Return the date seconds value. | |
void | SetSeconds (int value) |
Set the date seconds value. | |
int | DaysBetween (const Date &other) const |
Return the number of days with the given date. | |
void | SetDate (int year, int month, int day) |
Set the date part. | |
void | SetTime (int hour, int min, int sec) |
Set the time part. | |
void | SetDateTime (int year, int month, int day, int hour, int min, int sec) |
Set the date and time part. | |
void | GetDate (int &year, int &month, int &day) const |
Extract the date parts. | |
void | GetTime (int &hour, int &min, int &sec) const |
Extract time parts. | |
void | GetDateTime (int &year, int &month, int &day, int &hour, int &min, int &sec) const |
Extract the date and time parts. | |
void | AddDays (int days) |
Add or subtract days. | |
void | AddMonths (int months) |
Add or subtract months. | |
Date | NextDay (const ostring &day) const |
Return the date of next day of the week, after the current date object. | |
Date | LastDay () const |
Return the last day of month from the current date object. | |
void | ChangeTimeZone (const ostring &tzSrc, const ostring &tzDst) |
Convert the date from one zone to another zone. | |
void | FromString (const ostring &str, const ostring &format=OTEXT("")) |
Assign to the date object the value provided by the input date time string. | |
ostring | ToString (const ostring &format) const |
Convert the date value to a string using the given format. | |
ostring | ToString () const override |
Convert the date value to a string using default format OCI_STRING_FORMAT_DATE. | |
Date | Clone () const |
Clone the current instance to a new one performing deep copy. | |
Date & | operator++ () |
Increment the date by 1 day. | |
Date | operator++ (int) |
Increment the date by 1 day. | |
Date & | operator-- () |
Decrement the date by 1 day. | |
Date | operator-- (int) |
Decrement the date by 1 day. | |
Date | operator+ (int value) const |
Return a new date holding the current date value incremented by the given number of days. | |
Date | operator- (int value) const |
Return a new date holding the current date value decremented by the given number of days. | |
Date & | operator+= (int value) |
Increment the date by the given number of days. | |
Date & | operator-= (int value) |
Decrement the date by the given number of days. | |
bool | operator== (const Date &other) const |
Indicates if the current date value is equal to the given date value. | |
bool | operator!= (const Date &other) const |
Indicates if the current date value is not equal the given date value. | |
bool | operator> (const Date &other) const |
Indicates if the current date value is superior to the given date value. | |
bool | operator< (const Date &other) const |
Indicates if the current date value is inferior to the given date value. | |
bool | operator>= (const Date &other) const |
Indicates if the current date value is superior or equal to the given date value. | |
bool | operator<= (const Date &other) const |
Indicates if the current date value is inferior or equal to the given date value. | |
Static Public Member Functions | |
static Date | SysDate () |
Return the current system date time. | |
Object identifying the SQL data type DATE.
This class wraps the OCILIB object handle OCI_Date and its related methods
|
inline |
|
inline |
Create a date object with the value provided by the input date time string.
str | - String date time |
format | - format of the date time provided in parameter 'data' |
Definition at line 43 of file Date.hpp.
References FromString().
Create a date object with the value provided by the input date time string.
str | - String date time |
format | - format of the date time provided in parameter 'data' |
Definition at line 36 of file Date.hpp.
References FromString().
|
inlinestatic |
Return the current system date time.
Definition at line 64 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateSysDate().
|
inline |
Check if the given date is valid.
Definition at line 91 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateCheck().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the number of days with the given date.
other | - date to compare |
Definition at line 198 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateDaysBetween().
|
inline |
Set the date part.
year | - Year value |
month | - Month value |
day | - Day value |
Definition at line 203 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateSetDate().
Referenced by SetDay(), SetMonth(), and SetYear().
|
inline |
Set the time part.
hour | - Hour value |
min | - Minute value |
sec | - Second value |
Definition at line 208 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateSetTime().
Referenced by SetHours(), SetMinutes(), and SetSeconds().
|
inline |
Set the date and time part.
year | - Year value |
month | - Month value |
day | - Day value |
hour | - Hour value |
min | - Minute value |
sec | - Second value |
Definition at line 213 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateSetDateTime().
|
inline |
Extract the date parts.
year | - Place holder for year value |
month | - Place holder for month value |
day | - Place holder for day value |
Definition at line 218 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateGetDate().
Referenced by GetDay(), GetMonth(), GetYear(), SetDay(), SetMonth(), and SetYear().
|
inline |
Extract time parts.
hour | - Place holder for hour value |
min | - Place holder for minute value |
sec | - Place holder for second value |
Definition at line 223 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateGetTime().
Referenced by GetHours(), GetMinutes(), GetSeconds(), SetHours(), SetMinutes(), and SetSeconds().
|
inline |
Extract the date and time parts.
year | - Place holder for year value |
month | - Place holder for month value |
day | - Place holder for day value |
hour | - Place holder for hour value |
min | - Place holder for minute value |
sec | - Place holder for second value |
Definition at line 228 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateGetDateTime().
|
inline |
Add or subtract days.
days | - Number of days to add/remove |
Definition at line 233 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateAddDays().
Referenced by operator+=(), and operator-=().
|
inline |
Add or subtract months.
months | - Number of months to add/remove |
Definition at line 238 of file Date.hpp.
References OCI_DateAddMonths().
Return the date of next day of the week, after the current date object.
day | - Day of the week |
Definition at line 243 of file Date.hpp.
References ocilib::core::Check(), Clone(), and OCI_DateNextDay().
|
inline |
Return the last day of month from the current date object.
Definition at line 252 of file Date.hpp.
References ocilib::core::Check(), Clone(), and OCI_DateLastDay().
Convert the date from one zone to another zone.
tzSrc | - Source zone |
tzDst | - Destination zone |
Definition at line 261 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateZoneToZone().
Assign to the date object the value provided by the input date time string.
str | - String date time |
format | - format of the date time provided in parameter 'data' |
Definition at line 266 of file Date.hpp.
References ocilib::core::Check(), ocilib::FormatDate, ocilib::Environment::GetFormat(), and OCI_DateFromText().
Referenced by Date().
Convert the date value to a string using the given format.
format | - date time format to use |
Definition at line 271 of file Date.hpp.
References ocilib::core::Check(), ocilib::core::MakeString(), and OCI_DateToText().
|
inlineoverridevirtual |
Convert the date value to a string using default format OCI_STRING_FORMAT_DATE.
Implements ocilib::core::Streamable.
Definition at line 287 of file Date.hpp.
References ocilib::FormatDate, ocilib::Environment::GetFormat(), and ToString().
Referenced by ToString().
|
inline |
Clone the current instance to a new one performing deep copy.
Definition at line 75 of file Date.hpp.
References ocilib::core::Check(), and OCI_DateAssign().
Referenced by LastDay(), NextDay(), operator+(), operator++(), operator-(), and operator--().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |