PoDoFo  0.9.4
Public Member Functions | List of all members
PoDoFo::PdfDate Class Reference

#include <PdfDate.h>

Public Member Functions

 PdfDate ()
 
 PdfDate (const time_t &t)
 
 PdfDate (const PdfString &sDate)
 
virtual ~PdfDate ()
 
bool IsValid () const
 
const time_t & GetTime () const
 
void ToString (PdfString &rsString) const
 

Detailed Description

This class is a date datatype as specified in the PDF reference. You can easily convert from Unix time_t to the PDF time representation and back. Dates like these are used for example in the PDF info dictionary for the creation time and date of the PDF file.

PdfDate objects are immutable.

From the PDF reference:

PDF defines a standard date format, which closely follows that of the international standard ASN.1 (Abstract Syntax Notation One), defined in ISO/IEC 8824 (see the Bibliography). A date is a string of the form (D:YYYYMMDDHHmmSSOHH'mm')

Constructor & Destructor Documentation

PoDoFo::PdfDate::PdfDate ( )

Create a PdfDate object with the current date and time.

PoDoFo::PdfDate::PdfDate ( const time_t &  t)

Create a PdfDate with a specified date and time

Parameters
tthe date and time of this object

Use IsValid to check wether the time_t could be converted to a valid PdfDate object.

See also
IsValid()
PoDoFo::PdfDate::PdfDate ( const PdfString sDate)

Create a PdfDate with a specified date and time

Parameters
szDatethe date and time of this object in PDF format. It has to be a string of the format (D:YYYYMMDDHHmmSSOHH'mm'). Otherwise IsValid will return false.

Use IsValid to check wether the string could be converted to a valid PdfDate object.

See also
IsValid()
PoDoFo::PdfDate::~PdfDate ( )
virtual

Delete the PdfDate object

Member Function Documentation

const time_t & PoDoFo::PdfDate::GetTime ( ) const
inline
Returns
the date and time of this PdfDate in seconds since epoch.
bool PoDoFo::PdfDate::IsValid ( ) const
inline

You can use this function to check wether the date you passed to the constructor could be converted to a valid pdf date string or a valid time_t.

Returns
true if the PdfDate object is valid
void PoDoFo::PdfDate::ToString ( PdfString rsString) const
inline

The value returned by this function can be used in any PdfObject where a date is needed.

Parameters
rsStringwrite the date to a PdfString