Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Static Public Member Functions

DateTime Class Reference
[Datastructures]

DateTime Class. More...

#include <OpenMS/DATASTRUCTURES/DateTime.h>

Inheritance diagram for DateTime:
QDateTime

List of all members.

Public Member Functions

 DateTime ()
 Default constructor.
 DateTime (const DateTime &date)
 Copy constructor.
 DateTime (const QDateTime &date)
 Copy constructor from Qt base class.
DateTimeoperator= (const DateTime &source)
 Assignment operator.
void setDate (const String &date)
 sets date from a string
void setTime (const String &date)
 sets time from a string
void setDate (UInt month, UInt day, UInt year)
 sets data from three integers
void setTime (UInt hour, UInt minute, UInt second)
 sets time from three integers
void set (UInt month, UInt day, UInt year, UInt hour, UInt minute, UInt second)
 sets data from six integers
void get (UInt &month, UInt &day, UInt &year, UInt &hour, UInt &minute, UInt &second) const
 Fills the arguments with the date and the time.
void getDate (UInt &month, UInt &day, UInt &year) const
 Fills the arguments with the date.
String getDate () const
 Returns the date as string.
void getTime (UInt &hour, UInt &minute, UInt &second) const
 Fills the arguments with the time.
String getTime () const
 Returns the time as string.
void clear ()
 Sets the undefined date: 00/00/0000 00:00:00.
String get () const
 Returns a string representation of the date and time.
void set (const String &date)
 Sets date and time.

Static Public Member Functions

static DateTime now ()
 Returns the current date and time.

Detailed Description

DateTime Class.

This class implements date handling. Import and export to/from both string and integers is possible.


Constructor & Destructor Documentation

DateTime (  ) 

Default constructor.

Fills the object with an undefined date: 00/00/0000

DateTime ( const DateTime date  ) 

Copy constructor.

DateTime ( const QDateTime date  ) 

Copy constructor from Qt base class.


Member Function Documentation

void clear (  ) 

Sets the undefined date: 00/00/0000 00:00:00.

void get ( UInt month,
UInt day,
UInt year,
UInt hour,
UInt minute,
UInt second 
) const

Fills the arguments with the date and the time.

Give the numbers in the following order: month, day and year, hour minute, second.

Referenced by MzXMLHandler< MapType >::writeTo(), and MzDataHandler< MapType >::writeTo().

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

void getDate ( UInt month,
UInt day,
UInt year 
) const

Fills the arguments with the date.

Give the numbers in the following order: month, day and year.

String getDate (  )  const

Returns the date as string.

The format of the string is yyyy-MM-dd

void getTime ( UInt hour,
UInt minute,
UInt second 
) const

Fills the arguments with the time.

The arguments are all UInts and the order is hour minute second

Referenced by TOPPViewBase::showLogMessage_(), TOPPASBase::showLogMessage_(), and IDEvaluationBase::showLogMessage_().

String getTime (  )  const

Returns the time as string.

The format of the string is hh:mm:ss

DateTime& operator= ( const DateTime source  ) 

Assignment operator.

void set ( UInt  month,
UInt  day,
UInt  year,
UInt  hour,
UInt  minute,
UInt  second 
)

sets data from six integers

Give the numbers in the following order: month, day, year, hour, minute, second.

Exceptions:
Exception::ParseError 

Referenced by XMLHandler::asDateTime_(), MzMLHandler< MapType >::handleCVParam_(), XMassFile::importExperimentalSettings(), DBAdapter::loadExperiment(), and DBAdapter::loadSpectrum().

void set ( const String date  ) 

Sets date and time.

The following formats are supported:

  • MM/dd/yyyy hh:mm:ss
  • dd.MM.yyyy hh:mm:ss
  • yyyy-MM-dd hh:mm:ss
  • yyyy-MM-ddThh:mm:ss (ISO 8601 format)
  • yyyy-MM-ddZ (ISO 8601 format)
  • yyyy-MM-dd+hh:mm (ISO 8601 format)
Exceptions:
Exception::ParseError 
void setDate ( UInt  month,
UInt  day,
UInt  year 
)

sets data from three integers

Give the numbers in the following order: month, day and year.

Exceptions:
Exception::ParseError 
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'

Exceptions:
Exception::ParseError 
void setTime ( UInt  hour,
UInt  minute,
UInt  second 
)

sets time from three integers

Give the numbers in the following order: hour, minute and second.

Exceptions:
Exception::ParseError 
void setTime ( const String date  ) 

sets time from a string

Reads time format: 'hh:mm:ss'

Exceptions:
Exception::ParseError 

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:51 using doxygen 1.7.1