====== IBPP::Timestamp ===== The IBPP::Timestamp class represents a SQL timestamp value. It is not an interface class, with automatic smart pointer management like for instance the [[database]] class. It is a plain classical C++ class. Use it to interact easily with TIMESTAMP (SQL) columns in your databases. ===== Definition ===== See the file ibpp.h for an up-to-date definition. A Timestamp is a pure inline class, inheriting simply from both the [[Date]] and [[Time]] classes and overriding some of the methods. This implies that a Timestamp is made of just two integers for its data part. The class Timestamp is a light object which you can use without fear of bulky data structures. Also, this documentation only describes methods which are overriden from their base [[Date]] and [[Time]] or added. All the other methods of their base classes are available. For instance, one can call the Date AddDays() method on a Timestamp value. ===== Methods ===== ==== void Clear() ==== Resets the date to -1 (invalid date) and the time to midnight (0), effectively clearing the Timestamp to its default value after construction. ==== void Today() ==== Similar to its Date counterpart, sets the date to today, but clears the time part to 0. ==== void Now() ==== Similar to its Time counterpart, sets both the date and the time to 'now' (local time). ===== Constructors ===== ==== Timestamp() ==== The default constructructor builds an empty timestamp (no date and midnight), same as if Clear() was called on an existing timestamp. ==== Time(int year, int month, int day) ==== Creates a Timestamp with that date and a time of 0. ==== Time(int year, int month, int day, int hour, int minute, int second, int tenthousands = 0) ==== Creates a Timestamp with that date and time, tenthousands being optional and defaulting to 0. ==== Timestamp(const Timestamp&) ==== Ordinary copy constructor. To make the Timestamp a good citizen of your code. ==== Timestamp(const Date&) ==== Creates a Timestamp by copying a Date. The time portion is set to 0. ==== Timestamp(const Time&) ==== Creates a Timestamp by copying a Time. The date is set to invalid (-1). ===== Operators ===== ==== Timestamp& operator=(const Timestamp&) ==== To assign a timestamp from another one. ==== Timestamp& operator=(const Date&) ==== To assign a timestamp from a date, the time portion is set to 0. ==== Timestamp& operator=(const Time&) ==== To assign a timestamp from a time, the date portion is set to invalid (-1). ==== bool operator==(const Timestamp&) ==== To compare two Timestamps for equality (date and time exactly equal). ==== bool operator<(const Timestamp&) ==== To compare if one Timestamp is strictly 'lower' (means 'before') the other. ===== See also ===== These classes are closely related to this one : * [[Date]] * [[Time]]