![]() |
OpenMS
|
#include <OpenMS/DATASTRUCTURES/DateTime.h>
Public Member Functions | |
| DateTime () | |
| Default constructor. More... | |
| DateTime (const DateTime &date) | |
| Copy constructor. More... | |
| DateTime (DateTime &&) noexcept | |
| Move constructor. More... | |
| DateTime & | operator= (const DateTime &source) |
| Assignment operator. More... | |
| DateTime & | operator= (DateTime &&) &noexcept |
| Move assignment operator. More... | |
| ~DateTime () | |
| Destructor. More... | |
| bool | operator== (const DateTime &rhs) const |
| equal operator More... | |
| bool | operator!= (const DateTime &rhs) const |
| not-equal operator More... | |
| bool | operator< (const DateTime &rhs) const |
| less operator More... | |
| void | setDate (const String &date) |
| sets date from a string More... | |
| void | setTime (const String &date) |
| sets time from a string More... | |
| void | setDate (UInt month, UInt day, UInt year) |
| sets data from three integers More... | |
| void | setTime (UInt hour, UInt minute, UInt second) |
| sets time from three integers More... | |
| void | set (UInt month, UInt day, UInt year, UInt hour, UInt minute, UInt second) |
| sets data from six integers More... | |
| void | get (UInt &month, UInt &day, UInt &year, UInt &hour, UInt &minute, UInt &second) const |
| Fills the arguments with the date and the time. More... | |
| void | getDate (UInt &month, UInt &day, UInt &year) const |
| Fills the arguments with the date. More... | |
| String | getDate () const |
| Returns the date as string. More... | |
| void | getTime (UInt &hour, UInt &minute, UInt &second) const |
| Fills the arguments with the time. More... | |
| DateTime & | addSecs (int s) |
| String | getTime () const |
| Returns the time as string. More... | |
| bool | isValid () const |
| Returns true if the date time is valid. More... | |
| bool | isNull () const |
| return true if the date and time is null More... | |
| void | clear () |
| Sets the undefined date: 00/00/0000 00:00:00. More... | |
| String | toString (const std::string &format="yyyy-MM-ddThh:mm:ss") const |
| String | get () const |
| Returns a string representation of the date and time. More... | |
| void | set (const String &date) |
| Sets date and time. More... | |
Static Public Member Functions | |
| static DateTime | now () |
| Returns the current date and time. More... | |
| static DateTime | fromString (const std::string &date, const std::string &format="yyyy-MM-ddThh:mm:ss") |
Private Attributes | |
| std::unique_ptr< QDateTime > | dt_ |
DateTime Class.
This class implements date handling. Import and export to/from both string and integers is possible.
| DateTime | ( | ) |
Default constructor.
Fills the object with an undefined date: 00/00/0000
| ~DateTime | ( | ) |
Destructor.
| DateTime& addSecs | ( | int | s | ) |
| void clear | ( | ) |
Sets the undefined date: 00/00/0000 00:00:00.
|
static |
| String get | ( | ) | const |
Returns a string representation of the date and time.
The format of the string will be yyyy-MM-dd hh:mm:ss
Fills the arguments with the date and the time.
Give the numbers in the following order: month, day and year, hour minute, second.
| String getDate | ( | ) | const |
Returns the date as string.
The format of the string is yyyy-MM-dd
Fills the arguments with the date.
Give the numbers in the following order: month, day and year.
| String getTime | ( | ) | const |
Returns the time as string.
The format of the string is hh:mm:ss
Fills the arguments with the time.
The arguments are all UInts and the order is hour minute second
| bool isNull | ( | ) | const |
return true if the date and time is null
| bool isValid | ( | ) | const |
Returns true if the date time is valid.
|
static |
Returns the current date and time.
Referenced by PlotCanvas::addDataProcessing_(), and XMassFile::load().
| bool operator!= | ( | const DateTime & | rhs | ) | const |
not-equal operator
| bool operator< | ( | const DateTime & | rhs | ) | const |
less operator
| bool operator== | ( | const DateTime & | rhs | ) | const |
equal operator
| void set | ( | const String & | date | ) |
Sets date and time.
The following formats are supported:
| Exception::ParseError |
sets data from six integers
Give the numbers in the following order: month, day, year, hour, minute, second.
| Exception::ParseError |
Referenced by XMLHandler::asDateTime_(), and XMassFile::importExperimentalSettings().
| void setDate | ( | const String & | date | ) |
sets date from a string
Reads both English, German and iso/ansi date formats: 'MM/dd/yyyy', 'dd.MM.yyyy' or 'yyyy-MM-dd'
| Exception::ParseError |
sets data from three integers
Give the numbers in the following order: month, day and year.
| Exception::ParseError |
| void setTime | ( | const String & | date | ) |
sets time from three integers
Give the numbers in the following order: hour, minute and second.
| Exception::ParseError |
| String toString | ( | const std::string & | format = "yyyy-MM-ddThh:mm:ss" | ) | const |
|
private |