OCILIB (C and C++ Driver for Oracle)
4.6.3
|
Object identifying the SQL data type DATE. More...
#include <ocilib.hpp>
Inherits ocilib::HandleHolder< OCI_Date *>, and ocilib::Streamable.
Public Member Functions | |
Date (bool create=false) | |
Create an empty null Date object. More... | |
Date (const otext *str, const otext *format=OTEXT("")) | |
Create a date object with the value provided by the input date time string. More... | |
Date (const ostring &str, const ostring &format=OTEXT("")) | |
Create a date object with the value provided by the input date time string. More... | |
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. More... | |
void | SetDate (int year, int month, int day) |
Set the date part. More... | |
void | SetTime (int hour, int min, int sec) |
Set the time part. More... | |
void | SetDateTime (int year, int month, int day, int hour, int min, int sec) |
Set the date and time part. More... | |
void | GetDate (int &year, int &month, int &day) const |
Extract the date parts. More... | |
void | GetTime (int &hour, int &min, int &sec) const |
Extract time parts. More... | |
void | GetDateTime (int &year, int &month, int &day, int &hour, int &min, int &sec) const |
Extract the date and time parts. More... | |
void | AddDays (int days) |
Add or subtract days. More... | |
void | AddMonths (int months) |
Add or subtract months. More... | |
Date | NextDay (const ostring &day) const |
Return the date of next day of the week, after the current date object. More... | |
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. More... | |
void | FromString (const ostring &str, const ostring &format=OTEXT("")) |
Assign to the date object the value provided by the input date time string. More... | |
ostring | ToString (const ostring &format) const |
Convert the date value to a string using the given format. More... | |
ostring | ToString () const override |
Convert the date value to a string using default format OCI_STRING_FORMAT_DATE. More... | |
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
Definition at line 2831 of file ocilib.hpp.
|
inline |
Create an empty null Date object.
create | - Indicates if a Oracle Date object must be must be created |
Definition at line 2044 of file ocilib_impl.hpp.
Referenced by Date().
|
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 2059 of file ocilib_impl.hpp.
References ocilib::Check(), Date(), OCI_DateCreate(), and OCI_DateFree().
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 2052 of file ocilib_impl.hpp.
|
inline |
Return the number of days with the given date.
other | - date to compare |
Definition at line 2210 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_DateDaysBetween().
|
inline |
Set the date part.
year | - Year value |
month | - Month value |
day | - Day value |
Definition at line 2215 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_DateSetDate().
|
inline |
Set the time part.
hour | - Hour value |
min | - Minute value |
sec | - Second value |
Definition at line 2220 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_DateSetTime().
|
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 2225 of file ocilib_impl.hpp.
References ocilib::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 2230 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_DateGetDate().
|
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 2235 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_DateGetTime().
|
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 2240 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_DateGetDateTime().
|
inline |
Add or subtract days.
days | - Number of days to add/remove |
Definition at line 2245 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_DateAddDays().
|
inline |
Add or subtract months.
months | - Number of months to add/remove |
Definition at line 2250 of file ocilib_impl.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 2255 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_DateNextDay().
Convert the date from one zone to another zone.
tzSrc | - Source zone |
tzDst | - Destination zone |
Definition at line 2273 of file ocilib_impl.hpp.
References ocilib::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 2278 of file ocilib_impl.hpp.
References ocilib::Check(), ocilib::FormatDate, ocilib::Environment::GetFormat(), and OCI_DateFromText().
Convert the date value to a string using the given format.
format | - date time format to use |
Definition at line 2283 of file ocilib_impl.hpp.
References ocilib::Check(), ocilib::MakeString(), and OCI_DateToText().
|
inlineoverridevirtual |
Convert the date value to a string using default format OCI_STRING_FORMAT_DATE.
Implements ocilib::Streamable.
Definition at line 2299 of file ocilib_impl.hpp.
References ocilib::FormatDate, and ocilib::Environment::GetFormat().