Foxit PDF SDK
foxit::DateTime Class Reference

Inherits Object.

Public Member Functions

 DateTime (uint16 year, uint16 month, uint16 day, uint16 hour, uint16 minute, uint16 second, uint16 milliseconds, int16 utc_hour_offset, uint16 utc_minute_offset)
 Constructor, with parameters. More...
 
 DateTime ()
 Constructor.
 
 DateTime (const FXCRT_DATETIMEZONE &time)
 Constructor, with FXCRT_DATETIMEZONE object. More...
 
 DateTime (const DateTime &dt)
 Constructor, with another date and time object. More...
 
bool IsValid () const
 Check whether current object is valid or not. More...
 
bool operator != (const DateTime &datetime) const
 Not equal operator. More...
 
bool operator > (const DateTime &datetime) const
 Greater operator. More...
 
bool operator >= (const DateTime &datetime) const
 Greater or equal operator. More...
 
 operator FXCRT_DATETIMEZONE () const
 Convert to a FXCRT_DATETIMEZONE object.
 
bool operator< (const DateTime &datetime) const
 Smaller operator. More...
 
bool operator<= (const DateTime &datetime) const
 Smaller or equal operator. More...
 
DateTimeoperator= (const DateTime &dt)
 Assign operator. More...
 
bool operator== (const DateTime &datetime) const
 Equal operator. More...
 
void Set (uint16 year, uint16 month, uint16 day, uint16 hour, uint16 minute, uint16 second, uint16 milliseconds, int16 utc_hour_offset, uint16 utc_minute_offset)
 Set value. More...
 
DateTimeToLocalTime ()
 Convert current object to local time. More...
 
DateTimeToUTCTime ()
 Convert current object to UTC time. More...
 

Static Public Member Functions

static DateTime GetLocalTime ()
 Get local time. More...
 
static DateTime GetUTCTime ()
 Get UTC time. More...
 

Public Attributes

uint16 day
 Day of month. Valid range: from 1 to 31.
 
uint16 hour
 Hour. Valid range: from 0 to 23.
 
uint16 milliseconds
 Millisecond. Valid range: from 0 to 999. PDF standard does not support now, this can be omitted if it is not applicable.
 
uint16 minute
 Minute. Valid range: from 0 to 59.
 
uint16 month
 Month. Valid range: from 1 to 12.
 
uint16 second
 Second. Valid range: from 0 to 60. 60 for leap second.
 
int16 utc_hour_offset
 Hour of time zone. Valid range: from -12 to 12. More...
 
uint16 utc_minute_offset
 Minute of time zone. Valid range: from 0 to 59.
 
uint16 year
 Year. It should be a four-digit number, such as 2014.
 

Detailed Description

This class represents date, time and timezone.

Constructor & Destructor Documentation

◆ DateTime() [1/3]

foxit::DateTime::DateTime ( uint16  year,
uint16  month,
uint16  day,
uint16  hour,
uint16  minute,
uint16  second,
uint16  milliseconds,
int16  utc_hour_offset,
uint16  utc_minute_offset 
)
inline

Constructor, with parameters.

Parameters
[in]yearYear. It should be a four-digit number, such as 2014.
[in]monthMonth. Valid range: from 1 to 12.
[in]dayDay of month. Valid range: from 1 to 31.
[in]hourHour. Valid range: from 0 to 23.
[in]minuteMinute. Valid range: from 0 to 59.
[in]secondSecond. Valid range: from 0 to 60. 60 for leap second.
[in]millisecondsMillisecond. Valid range: from 0 to 999. PDF standard does not support now, this can be omitted if it is not applicable.
[in]utc_hour_offsetHour of time zone. Valid range: from -12 to 12. Positive value for the eastern time zone, and negative value for the western time zone.
[in]utc_minute_offsetMinute of time zone. Valid range: from 0 to 59.

◆ DateTime() [2/3]

foxit::DateTime::DateTime ( const FXCRT_DATETIMEZONE time)
explicit

Constructor, with FXCRT_DATETIMEZONE object.

Parameters
[in]timeA FXCRT_DATETIMEZONE object.

◆ DateTime() [3/3]

foxit::DateTime::DateTime ( const DateTime dt)
inline

Constructor, with another date and time object.

Parameters
[in]dtAnother date and time object.

Member Function Documentation

◆ GetLocalTime()

static DateTime foxit::DateTime::GetLocalTime ( )
static

Get local time.

Returns
Local time.

◆ GetUTCTime()

static DateTime foxit::DateTime::GetUTCTime ( )
static

Get UTC time.

Returns
UTC time.

◆ IsValid()

bool foxit::DateTime::IsValid ( ) const

Check whether current object is valid or not.

When the current object is not valid, that means current object is useless.

Returns
true means current object is valid, while false means not.

◆ operator !=()

bool foxit::DateTime::operator != ( const DateTime datetime) const

Not equal operator.

Parameters
[in]datetimeAnother date and time object. This function will check if current object is not equal to this one.
Returns
true means not equal, while false means equal.

◆ operator >()

bool foxit::DateTime::operator > ( const DateTime datetime) const

Greater operator.

Parameters
[in]datetimeAnother date and time object. This function will check if current object is greater than this one.
Returns
true means current object is greater, while false means current object is not greater.

◆ operator >=()

bool foxit::DateTime::operator >= ( const DateTime datetime) const

Greater or equal operator.

Parameters
[in]datetimeAnother date and time object. This function will check if current object is greater than or equal to this one.
Returns
true means current object is greater than or equal to the input one, while false means current object is smaller than the input one.

◆ operator<()

bool foxit::DateTime::operator< ( const DateTime datetime) const

Smaller operator.

Parameters
[in]datetimeAnother date and time object. This function will check if current object is smaller than this one.
Returns
true means current object is smaller, while false means current object is not smaller.

◆ operator<=()

bool foxit::DateTime::operator<= ( const DateTime datetime) const

Smaller or equal operator.

Smaller or equal operator.

Parameters
[in]datetimeAnother date and time object. This function will check if current object is smaller than or equal to this one.
Returns
true means current object is smaller than or equal to the input one, while false means current object is greater than the input one.

◆ operator=()

DateTime& foxit::DateTime::operator= ( const DateTime dt)
inline

Assign operator.

Parameters
[in]dtAnother date and time object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ operator==()

bool foxit::DateTime::operator== ( const DateTime datetime) const

Equal operator.

Parameters
[in]datetimeAnother date and time object. This function will check if current object is equal to this one.
Returns
true means equal, while false means not equal.

◆ Set()

void foxit::DateTime::Set ( uint16  year,
uint16  month,
uint16  day,
uint16  hour,
uint16  minute,
uint16  second,
uint16  milliseconds,
int16  utc_hour_offset,
uint16  utc_minute_offset 
)
inline

Set value.

Parameters
[in]yearYear. It should be a four-digit number, such as 2014.
[in]monthMonth. Valid range: from 1 to 12.
[in]dayDay of month. Valid range: from 1 to 31.
[in]hourHour. Valid range: from 0 to 23.
[in]minuteMinute. Valid range: from 0 to 59.
[in]secondSecond. Valid range: from 0 to 60. 60 for leap second.
[in]millisecondsMillisecond. Valid range: from 0 to 999. PDF standard does not support now, this can be omitted if it is not applicable.
[in]utc_hour_offsetHour of time zone. Valid range: from -12 to 12. Positive value for the eastern time zone, and negative value for the western time zone.
[in]utc_minute_offsetMinute of time zone. Valid range: from 0 to 59.
Returns
None.

◆ ToLocalTime()

DateTime& foxit::DateTime::ToLocalTime ( )

Convert current object to local time.

Returns
Refernce to current object itself.

◆ ToUTCTime()

DateTime& foxit::DateTime::ToUTCTime ( )

Convert current object to UTC time.

Returns
Refernce to current object itself.

Member Data Documentation

◆ utc_hour_offset

int16 foxit::DateTime::utc_hour_offset

Hour of time zone. Valid range: from -12 to 12.

Positive value for the eastern time zone, and negative value for the western time zone.