DateTime Class Reference

Date and Time class. More...

List of all members.

Public Member Functions

DateTime date ()
 Stamps the time part of the DateTime and returns an object containing only DATE information (or the TIME information is all zeros).
 DateTime (const DateTime &rhs)
 Copy constructor.
 DateTime (unsigned year, unsigned month, unsigned day, unsigned hour=0, unsigned minute=0, unsigned seconds=0, unsigned milliseconds=0)
 Constructs a date according to the values given.
 DateTime (const tstring &date, const tstring &format)
 Construct a DateTime object from the given "date" which is being expected to be in the given "format".
 DateTime (const SYSTEMTIME &sysTime)
 Construct a new DateTime from the given SYSTEMTIME.
 DateTime ()
 Constructs by default the smallest possible date.
const SYSTEMTIME & getSystemTime ()
 Explicit conversion to SYSTEMTIME.
DateTimeoperator= (const SYSTEMTIME &rhs)
 Assignment operator which makes a copy of the SYSTEMTIME object on the right hand side of the assignment operator.
DateTimeoperator= (const DateTime &rhs)
 Assignment operator which makes a perfect copy of the DateTime object on the right hand side of the assignment operator.
tstring toDateString (const tstring &format) const
 Returns only the date part of the date time structure in a string format.
tstring toString () const
 Converts the date to a string in the format "yyyy.MM.ddThh:mm:ss".
tstring toTimeString (const tstring &format) const
 Returns a string containing only the Time of the object.

Static Public Member Functions

static DateTime minValue ()
 Static constructor creating the smallest possible value.
static DateTime now ()
 Static constructor creating a DateTime which will hold the Date and Time of the creation of the object.


Detailed Description

Date and Time class.

Class is inspired from the .Net Framework class System.DateTime and usable areas would be e.g. to parse DateTime objects transfered across SOAP callings


Constructor & Destructor Documentation

DateTime ( const tstring &  date,
const tstring &  format 
)

Construct a DateTime object from the given "date" which is being expected to be in the given "format".

format could be e.g. "yyyy.MM.dd" while date could be e.g. "2006.11.29"


Member Function Documentation

tstring toDateString ( const tstring &  format  )  const

Returns only the date part of the date time structure in a string format.

The format must be in format of e.g. "dd:MM-yyyy" or "yyyy:MM:dd" where "yyyy" is four digits year, "MM" is two digits months and "dd" is two digits day.

tstring toString (  )  const

Converts the date to a string in the format "yyyy.MM.ddThh:mm:ss".

Example: "2005.12.29T23:11:52"

tstring toTimeString ( const tstring &  format  )  const

Returns a string containing only the Time of the object.

The format must be in format of e.g. "hh.mm.ss" or "mm-ss/hh" etc where "hh" is hours, "mm" is minutes and "ss" is seconds.

Back to SmartWin website
SourceForge.net Logo