DATETIME_CUSTOMGUISETTINGS

Detailed Description

Groups

 DayOfWeek
 
 MonthOfYear
 

Classes

struct  DateTime
 
class  DateTimeControl
 
class  DateTimeData
 

Macros

#define DATETIME_TIME_CONTROL
 
#define DATETIME_DATE_CONTROL
 
#define DATETIME_NOW_BUTTON
 
#define DATETIME_NO_SECONDS
 
#define DATETIME_SHOW_LABELS
 

Functions

Int32 CompareDateTime (const DateTime &a, const DateTime &b)
 
 DateTimeControl ()
 
 ~DateTimeControl ()
 
DateTime GetDateTime () const
 
void SetDateTime (const DateTime &d, Bool bSetDate=true, Bool bSetTime=true)
 
 DateTimeData ()
 
 ~DateTimeData ()
 
static DateTimeDataAlloc ()
 
static void Free (DateTimeData *&pData)
 
DateTime GetDateTime () const
 
void SetDateTime (const DateTime &d, Bool bSetDate=true, Bool bSetTime=true)
 
Float64 GetJulianDay (const DateTime &t)
 
DateTime FromJulianDay (Float64 j)
 
void GetDateTimeNow (DateTime &t)
 
void GetDateTimeNowGM (DateTime &t)
 
Bool LocalToGMTime (const DateTime &tLocal, DateTime &tGMT)
 
Bool GMTimeToLocal (const DateTime &tGMT, DateTime &tLocal)
 
DAYOFWEEK GetDayOfWeek (Int32 lYear, Int32 lMonth, Int32 lDay)
 
String FormatTime (const char *pszFormat, const DateTime &t)
 
Bool ParseTimeString (String timestr, Int32 &hour, Int32 &minute, Int32 &second)
 
Bool ParseDateString (String datestr, Int32 &year, Int32 &month, Int32 &day)
 
String TimeToString (const DateTime &d, const Bool bShowSeconds=true)
 
String DateToString (const DateTime &d)
 
String GetMonthName (Int month)
 
void ValidateDate (Int32 &year, Int32 &month, Int32 &day)
 
void ValidateTime (Int32 &hour, Int32 &minute, Int32 &second)
 

Variables

Int32 year
 
Int32 month
 
Int32 day
 
Int32 hour
 
Int32 minute
 
Int32 second
 
 MONDAY
 
 TUESDAY
 
 WEDNESDAY
 
 THURSDAY
 
 FRIDAY
 
 SATURDAY
 
 SUNDAY
 
 JANUARY
 
 FEBRUARY
 
 MARCH
 
 APRIL
 
 MAY
 
 JUNE
 
 JULY
 
 AUGUST
 
 SEPTEMBER
 
 OCTOBER
 
 NOVEMBER
 
 DECEMBER
 

Constructors

 DateTime ()
 
 DateTime (Int32 t_year, Int32 t_month, Int32 t_day, Int32 t_hour, Int32 t_minute, Int32 t_second)
 

Operators

Bool operator== (const DateTime &b) const
 
Bool operator!= (const DateTime &b) const
 
Bool operator<= (const DateTime &b) const
 
Bool operator< (const DateTime &b) const
 
Bool operator>= (const DateTime &b) const
 
Bool operator> (const DateTime &b) const
 

Macro Definition Documentation

◆ DATETIME_TIME_CONTROL

#define DATETIME_TIME_CONTROL

Bool true, if it is a clock.

◆ DATETIME_DATE_CONTROL

#define DATETIME_DATE_CONTROL

Bool true, if it is a calendar.

◆ DATETIME_NOW_BUTTON

#define DATETIME_NOW_BUTTON

Bool true, to add "Now" button.

◆ DATETIME_NO_SECONDS

#define DATETIME_NO_SECONDS

Bool true, to not show seconds.

◆ DATETIME_SHOW_LABELS

#define DATETIME_SHOW_LABELS

Bool true, to show the "Date" and "Time" labels if the GUI is collapsed.

Function Documentation

◆ DateTime() [1/2]

DateTime ( )

Default constructor. (Sets the time to 2000-01-01 00:00:00.)

◆ DateTime() [2/2]

DateTime ( Int32  t_year,
Int32  t_month,
Int32  t_day,
Int32  t_hour,
Int32  t_minute,
Int32  t_second 
)

Creates a date and time with the given year/month/day and hour/minute/seconds.

Parameters
[in]t_yearYear.
[in]t_monthMonth.
[in]t_dayDay in month.
[in]t_hourHour.
[in]t_minuteMinute.
[in]t_secondSecond.

◆ operator==()

Bool operator== ( const DateTime b) const

Equality operator. Checks if the date time is equal to another.

Parameters
[in]bThe right-operand date time.
Returns
The result of the comparison.

◆ operator!=()

Bool operator!= ( const DateTime b) const

Inequality operator. Checks if the date time is not equal to another.

Parameters
[in]bThe right-operand date time.
Returns
The result of the comparison.

◆ operator<=()

Bool operator<= ( const DateTime b) const

Less than or equal operator. Checks if the date time is less than or equal to another.

Parameters
[in]bThe right-operand date time.
Returns
The result of the comparison.

◆ operator<()

Bool operator< ( const DateTime b) const

Less than operator. Checks if the date time is less than another.

Parameters
[in]bThe right-operand date time.
Returns
The result of the comparison.

◆ operator>=()

Bool operator>= ( const DateTime b) const

Greater than or equal operator. Checks if the date time is greater than or equal to another.

Parameters
[in]bThe right-operand date time.
Returns
The result of the comparison.

◆ operator>()

Bool operator> ( const DateTime b) const

Greater than operator. Checks if the date time is greater than another.

Parameters
[in]bThe right-operand date time.
Returns
The result of the comparison.

◆ CompareDateTime()

Int32 CompareDateTime ( const DateTime a,
const DateTime b 
)

Compare date times a and b.

Parameters
[in]aThe first date time.
[in]bThe second date time.
Returns
Less than 0 if a < b, equal to 0 if a == b and greater than 0 if a > b.

◆ DateTimeControl()

DateTimeControl ( )
private

◆ ~DateTimeControl()

~DateTimeControl ( )
private

◆ GetDateTime() [1/2]

DateTime GetDateTime ( ) const

Retrieves the date time.

Returns
The date time.

◆ SetDateTime() [1/2]

void SetDateTime ( const DateTime d,
Bool  bSetDate = true,
Bool  bSetTime = true 
)

Sets the date time.

Parameters
[in]dThe date time to set.
[in]bSetDateIf false the date part of d is discarded. Default to true.
[in]bSetTimeIf false the time part of d is discarded. Default to true.

◆ DateTimeData()

DateTimeData ( )
private

◆ ~DateTimeData()

~DateTimeData ( )
private

◆ Alloc()

static DateTimeData* Alloc ( )
static

Allocates a DateTime data. Destroy the allocated DateTime data with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated DateTime data, or nullptr if the allocation failed.

◆ Free()

static void Free ( DateTimeData *&  pData)
static

Destructs DateTime data allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]pDataThe DateTime data to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ GetDateTime() [2/2]

DateTime GetDateTime ( ) const

Retrieves the date time.

Returns
The date time.

◆ SetDateTime() [2/2]

void SetDateTime ( const DateTime d,
Bool  bSetDate = true,
Bool  bSetTime = true 
)

Sets the date time.

Parameters
[in]dThe date time to set.
[in]bSetDateIf false the date part of d is discarded. Default to true.
[in]bSetTimeIf false the time part of d is discarded. Default to true.

◆ GetJulianDay()

Float64 GetJulianDay ( const DateTime t)

Gets the Modified Julian Date (http://tycho.usno.navy.mil/mjd.html) from t.

Parameters
[in]tA date time.
Returns
The Modified Julian Date. To get the correct Julian day, take the integer of the value and subtract 0.5

◆ FromJulianDay()

DateTime FromJulianDay ( Float64  j)

Gets a date time from the Modified Julian Date (http://tycho.usno.navy.mil/mjd.html) j.

Parameters
[in]jA Modified Julian Date.
Returns
The date time.

◆ GetDateTimeNow()

void GetDateTimeNow ( DateTime t)

Retrieves the current system date time.

Parameters
[out]tFilled with the current system time.

◆ GetDateTimeNowGM()

void GetDateTimeNowGM ( DateTime t)

Retrieves the current system date time in GMT.

Parameters
[out]tFilled with the current system GMT time.

◆ LocalToGMTime()

Bool LocalToGMTime ( const DateTime tLocal,
DateTime tGMT 
)

Converts local time to GMT depending on the OS time zone settings.

Warning
The function will fail if the local date is before Jan 1, 1970 2.01 am or after Jan 18, 2038 7 pm.
Parameters
[in]tLocalThe local time.
[out]tGMTFilled with the calculated GMT time, or tLocal if an error occurred.
Returns
true if successful, otherwise false.

◆ GMTimeToLocal()

Bool GMTimeToLocal ( const DateTime tGMT,
DateTime tLocal 
)

Converts GMT time to local depending on the OS time zone settings.

Parameters
[in]tGMTThe GMT time.
[out]tLocalFilled with the calculated local time, or tGMT if an error occurred.
Returns
true if successful, otherwise false.

◆ GetDayOfWeek()

DAYOFWEEK GetDayOfWeek ( Int32  lYear,
Int32  lMonth,
Int32  lDay 
)

Gets the day of the week of the date lYear-lMonth-lDay.

Parameters
[in]lYearThe year.
[in]lMonthThe month number. (1 means January.)
[in]lDayThe day in the month.
Returns
The day of the week: DayOfWeek

◆ FormatTime()

String FormatTime ( const char *  pszFormat,
const DateTime t 
)

Formats the given date time t and output it as a string.

Parameters
[in]pszFormatThe format options (same as strftime() format).
[in]tThe date time to format.
Returns
The formatted string for the date time.

◆ ParseTimeString()

Bool ParseTimeString ( String  timestr,
Int32 hour,
Int32 minute,
Int32 second 
)

Parses a time string (e.g. "12:34:56").

Parameters
[in]timestrThe time string to parse. The format is "hour:minute:second".
[out]hourAssigned the parsed hour.
[out]minuteAssigned the parsed minute.
[out]secondAssigned the parsed second.
Returns
true if successful, otherwise false.

◆ ParseDateString()

Bool ParseDateString ( String  datestr,
Int32 year,
Int32 month,
Int32 day 
)

Parses a date string (e.g. "1/4/2010").

Parameters
[in]datestrThe date string to parse. The format is "day/month/year".
[out]yearAssigned the parsed year.
[out]monthAssigned the parsed month.
[out]dayAssigned the parsed day.
Returns
true if successful, otherwise false.

◆ TimeToString()

String TimeToString ( const DateTime d,
const Bool  bShowSeconds = true 
)

Converts a time as a formatted string (e.g. "12:34:56").

Parameters
[in]dThe date time.
[in]bShowSecondstrue to include seconds into the time string. Default to true.
Returns
The time string. The format is "hour:minute:second".

◆ DateToString()

String DateToString ( const DateTime d)

Converts a date as a formatted string.

Note
The format of the returned string depends on the current OS date and time settings.
Parameters
[in]dThe date time.
Returns
The date string.

◆ GetMonthName()

String GetMonthName ( Int  month)

Retrieves the name of a month in the current Cinema 4D interface language.

Parameters
[in]monthThe month: MonthOfYear
Returns
The month's name in the current Cinema 4D interface language.

◆ ValidateDate()

void ValidateDate ( Int32 year,
Int32 month,
Int32 day 
)

Tries to correct invalid date values, e.g. keeping the values within valid limits.

Parameters
[out]yearAssigned the corrected year.
[out]monthAssigned the corrected month.
[out]dayAssigned the corrected day.

◆ ValidateTime()

void ValidateTime ( Int32 hour,
Int32 minute,
Int32 second 
)

Tries to correct invalid time values, e.g. keeping the values within valid limits.

Parameters
[out]hourAssigned the corrected hour.
[out]minuteAssigned the corrected minute.
[out]secondAssigned the corrected second.

Variable Documentation

◆ year

Int32 year

Year.

◆ month

Int32 month

Month.

◆ day

Int32 day

Day in month.

◆ hour

Int32 hour

Hour.

◆ minute

Int32 minute

Minute.

◆ second

Int32 second

Second.

◆ MONDAY

MONDAY

◆ TUESDAY

TUESDAY

◆ WEDNESDAY

WEDNESDAY

◆ THURSDAY

THURSDAY

◆ FRIDAY

FRIDAY

◆ SATURDAY

SATURDAY

◆ SUNDAY

SUNDAY

◆ JANUARY

JANUARY

◆ FEBRUARY

FEBRUARY

◆ MARCH

MARCH

◆ APRIL

APRIL

◆ MAY

MAY

◆ JUNE

JUNE

◆ JULY

JULY

◆ AUGUST

AUGUST

◆ SEPTEMBER

SEPTEMBER

◆ OCTOBER

OCTOBER

◆ NOVEMBER

NOVEMBER

◆ DECEMBER

DECEMBER