OFDateTime Class Reference

This class is a combination of OFDate and OFTime. More...

List of all members.

Public Member Functions

 OFDateTime ()
 default constructor.
 OFDateTime (const OFDateTime &dateTime)
 copy constructor
 OFDateTime (const OFDate &dateVal, const OFTime &timeVal)
 copy constructor
 OFDateTime (const unsigned int year, const unsigned int month, const unsigned int day, const unsigned int hour, const unsigned int minute, const double second, const double timeZone=0)
 constructor
virtual ~OFDateTime ()
 destructor
virtual OFDateTimeoperator= (const OFDateTime &dateTime)
 assignment operator
virtual OFBool operator== (const OFDateTime &dateTime) const
 comparison operator (equal).
virtual OFBool operator!= (const OFDateTime &dateTime) const
 comparison operator (unequal) Please note that the time values are first transformed to the Coordinated Universal Time (UTC) before they are compared.
virtual void clear ()
 reset the date/time value.
virtual OFBool isValid () const
 check whether the currently stored date and time value is valid.
OFBool setDateTime (const unsigned int year, const unsigned int month, const unsigned int day, const unsigned int hour, const unsigned int minute, const double second, const double timeZone=0)
 set the date/time value.
OFBool setDate (const OFDate &dateVal)
 set the date component to the specified date.
OFBool setTime (const OFTime &timeVal)
 set the time component to the specified time.
OFBool setDateTime (const OFDate &dateVal, const OFTime &timeVal)
 set the date and time component to the specified date/time.
OFBool setCurrentDateTime ()
 set the date and time value to the current system date and time.
OFBool setISOFormattedDateTime (const OFString &formattedDateTime)
 set the date/time value to the given ISO formatted date/time string.
const OFDategetDate () const
 get the current date component
const OFTimegetTime () const
 get the current time component
OFBool getISOFormattedDateTime (OFString &formattedDateTime, const OFBool showSeconds=OFTrue, const OFBool showFraction=OFFalse, const OFBool showTimeZone=OFFalse, const OFBool showDelimiter=OFTrue) const
 get the current date/time value in ISO format.
OFBool getISOFormattedDateTime (OFString &formattedDateTime, const OFBool showSeconds, const OFBool showFraction, const OFBool showTimeZone, const OFBool showDelimiter, const OFString &dateTimeSeparator) const
 get the current date/time value in ISO format.

Static Public Member Functions

static OFDateTime getCurrentDateTime ()
 get the current system date and time

Private Attributes

OFDate Date
 currently stored date value
OFTime Time
 currently stored time value


Detailed Description

This class is a combination of OFDate and OFTime.

Definition at line 46 of file ofdatime.h.


Constructor & Destructor Documentation

OFDateTime::OFDateTime (  ) 

default constructor.

Initializes Date and Time to 0.

OFDateTime::OFDateTime ( const OFDateTime dateTime  ) 

copy constructor

Parameters:
dateTime date/time object to be copied

OFDateTime::OFDateTime ( const OFDate dateVal,
const OFTime timeVal 
)

copy constructor

Parameters:
dateVal date object to be copied
timeVal time object to be copied

OFDateTime::OFDateTime ( const unsigned int  year,
const unsigned int  month,
const unsigned int  day,
const unsigned int  hour,
const unsigned int  minute,
const double  second,
const double  timeZone = 0 
)

constructor

Parameters:
year year value to be set
month month value to be set
day new value to be set
hour hour value to be set
minute minute value to be set
second second value to be set (incl. fraction of seconds)
timeZone optional offset to Coordinated Universal Time (UTC) in hours


Member Function Documentation

virtual OFDateTime& OFDateTime::operator= ( const OFDateTime dateTime  )  [virtual]

assignment operator

Parameters:
dateTime date/time value to be set
Returns:
reference to this object (with new value)

virtual OFBool OFDateTime::operator== ( const OFDateTime dateTime  )  const [virtual]

comparison operator (equal).

Please note that the time values are first transformed to the Coordinated Universal Time (UTC) before they are compared. However, the special case that there is an "overflow" from one day to another is currently not handled.

Parameters:
dateTime date and time value compared with the current value
Returns:
OFTrue if given date and time is equal, OFFalse otherwise

virtual OFBool OFDateTime::operator!= ( const OFDateTime dateTime  )  const [virtual]

comparison operator (unequal) Please note that the time values are first transformed to the Coordinated Universal Time (UTC) before they are compared.

However, the special case that there is an "overflow" from one day to another is currently not handled.

Parameters:
dateTime date and time value compared with the current value
Returns:
OFTrue if given date or time is unequal, OFFalse otherwise

virtual void OFDateTime::clear (  )  [virtual]

reset the date/time value.

Sets all date and all time components to '0'. NB: Date becomes invalid.

virtual OFBool OFDateTime::isValid (  )  const [virtual]

check whether the currently stored date and time value is valid.

See classes OFDate and OFTime for details.

Returns:
OFTrue if the current value is valid, OFFalse otherwise

OFBool OFDateTime::setDateTime ( const unsigned int  year,
const unsigned int  month,
const unsigned int  day,
const unsigned int  hour,
const unsigned int  minute,
const double  second,
const double  timeZone = 0 
)

set the date/time value.

Before the new value is set it is checked using the "isValid()" routine.

Parameters:
year new year value to be set
month new month value to be set
day new day value to be set
hour new hour value to be set
minute new minute value to be set
second new second value to be set (incl. fraction of seconds)
timeZone optional offset to Coordinated Universal Time (UTC) in hours
Returns:
OFTrue if the new value is valid and has been set, OFFalse otherwise

OFBool OFDateTime::setDate ( const OFDate dateVal  ) 

set the date component to the specified date.

Before the new value is set it is checked using the "isValid()" routine.

Parameters:
dateVal new date value to be set
Returns:
OFTrue if the new value is valid and has been set, OFFalse otherwise

OFBool OFDateTime::setTime ( const OFTime timeVal  ) 

set the time component to the specified time.

Before the new value is set it is checked using the "isValid()" routine.

Parameters:
timeVal new time value to be set
Returns:
OFTrue if the new value is valid and has been set, OFFalse otherwise

OFBool OFDateTime::setDateTime ( const OFDate dateVal,
const OFTime timeVal 
)

set the date and time component to the specified date/time.

Before the new value is set it is checked using the "isValid()" routine.

Parameters:
dateVal new date value to be set
timeVal new time value to be set
Returns:
OFTrue if the new value is valid and has been set, OFFalse otherwise

OFBool OFDateTime::setCurrentDateTime (  ) 

set the date and time value to the current system date and time.

This function uses operating system dependent routines. If the date or time function (or both) are unavailable for some reason the corresponding value is not modified.

Returns:
OFTrue if the current system date and time has been set, OFFalse otherwise

OFBool OFDateTime::setISOFormattedDateTime ( const OFString formattedDateTime  ) 

set the date/time value to the given ISO formatted date/time string.

The two ISO date/time formats supported by this function are

const OFDate& OFDateTime::getDate (  )  const

get the current date component

Returns:
reference to date object

const OFTime& OFDateTime::getTime (  )  const

get the current time component

Returns:
reference to time object

OFBool OFDateTime::getISOFormattedDateTime ( OFString formattedDateTime,
const OFBool  showSeconds = OFTrue,
const OFBool  showFraction = OFFalse,
const OFBool  showTimeZone = OFFalse,
const OFBool  showDelimiter = OFTrue 
) const

get the current date/time value in ISO format.

The two ISO time formats supported by this function are

OFBool OFDateTime::getISOFormattedDateTime ( OFString formattedDateTime,
const OFBool  showSeconds,
const OFBool  showFraction,
const OFBool  showTimeZone,
const OFBool  showDelimiter,
const OFString dateTimeSeparator 
) const

get the current date/time value in ISO format.

Same as above but allows to specify the separator between date and time value. Only required since Sun CC 2.0.1 compiler does not support default parameter values for "complex types" like OFString. Reports the error message: "Sorry not implemented" :-/

Parameters:
formattedDateTime reference to string variable where the result is stored
showSeconds add optional seconds (":SS" or "SS") to the resulting string if OFTrue
showFraction add optional fractional part of a second (".FFFFFF") if OFTrue. Requires parameter 'seconds' to be also OFTrue.
showTimeZone add optional time zone ("&ZZ:ZZ" or "&ZZZZ") to the resulting string if OFTrue. The time zone indicates the offset from the Coordinated Universal Time (UTC) in hours and minutes. The "&" is a placeholder for the sign symbol ("+" or "-").
showDelimiter flag, indicating whether to use delimiters ("-", ":" and " ") or not
dateTimeSeparator separator between ISO date and time value (default: " "). Only used if 'showDelimiter' is true.
Returns:
OFTrue if result variable has been set, OFFalse otherwise

static OFDateTime OFDateTime::getCurrentDateTime (  )  [static]

get the current system date and time

Returns:
date/time object with the current system date and time set


The documentation for this class was generated from the following file:


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1