Help Center
Help CenterAfxNovaDateTime

CTime64 Class

Members (33)

CAST OperatorReturns the **CTime64** value as a long integer.ConstructorsCreate new **CTime64** objects initialized to the specified value.FormatConverts a **CTime64** object to a string.FormatGmtConverts a **CTime64** object to a string.GetAsFileTimeReturns the time as a **FILETIME** structure.GetAsSystemTimeReturns the time as a **SYSTEMTIME** structure.GetCurrentTimeReturns a **CTime64** object that represents the current system date and time.GetDayReturns the day represented by the **CTime64** object.GetDayOfWeekReturns the day of the week represented by the **CTime64** object.GetGmtTimeGets a **tm** structure that contains a decomposition of the time contained in this **CTime64** object.GetHourReturns the hour represented by the **CTime64** object.GetLocalTimeGets a **tm** structure that contains a decomposition of the time contained in this **CTime64** object.GetMinuteReturns the minute represented by the **CTime64** object.GetMonthReturns the month represented by the **CTime64** object.GetSecondReturns the second represented by the **CTime64** object.GetTimeReturns a **\_\_time64_t** (LONGLONG) value for the given **CTime64** object.GetYearReturns the year represented by the **CTime64** object.LET OperatorAssigns a value to a **CTime64** object.OperatorsAdds, subtracts or compares **CTime64** objects.SetDateTimeSets the date and time of this **CTime64** object.CAST OperatorReturns the **CTimeSpan** value as a long integer.ConstructorsCreate new **CTimeSpan** objects initialized to the specified value.GetDaysReturns a value that represents the number of days in this **CTimeSpan**.GetHoursReturns a value that represents the number of hours in the current day (–23 through 23).GetMinutesReturns a value that represents the number of minutes in the current hour (–59 through 59).GetSecondsReturns a value that represents the number of seconds in the current hour (–59 through 59).GetTimeSpanReturns the underlying time value from this **CTimeSpan** object.GetTotalHoursReturns a value that represents the total number of complete hours in this **CTimeSpan**.GetTotalMinutesReturns a value that represents the total number of complete minutes in this **CTimeSpan**.GetTotalSecondsRetrieves this date/time-span value expressed in seconds.LET OperatorAssigns a value to a **CTimeSpan** object.OperatorsAdds, subtracts or compares **CTimeSpan** objects.SetTimeSpanSets the value of this date/time-span value.

Documentation

CTime64 Class

Represents an absolute time and date.

  • CTime64 values are based on coordinated universal time (UTC), which is equivalent to Coordinated Universal time (Greenwich Mean Time, GMT).
  • A companion class, CTimeSpan, represents a time interval.
  • The upper date limit is 12/31/3000. The lower limit is 1/1/1970 12:00:00 AM GMT.

Include file: AfxNova/CTime64.inc

NameDescription
ConstructorsCreate new CTime64 objects initialized to the specified value.
CAST OperatorReturns the CTime64 value as a long integer.
LET OperatorAssigns a value to a CTime64 object.
OperatorsAdds, subtracts or compares CTime64 objects.
FormatConverts a CTime64 object to a string.
FormatGmtConverts a CTime64 object to a string.
GetAsFileTimeReturns the time as a FILETIME structure.
GetAsSystemTimeReturns the time as a SYSTEMTIME structure.
GetCurrentTimeReturns a CTime64 object that represents the current system date and time.
GetDayReturns the day represented by the CTime64 object.
GetDayOfWeekReturns the day of the week represented by the CTime64 object.
GetGmtTimeGets a tm structure that contains a decomposition of the time contained in this CTime64 object.
GetHourReturns the hour represented by the CTime64 object.
GetLocalTimeGets a tm structure that contains a decomposition of the time contained in this CTime64 object.
GetMinuteReturns the minute represented by the CTime64 object.
GetMonthReturns the month represented by the CTime64 object.
GetSecondReturns the second represented by the CTime64 object.
GetTimeReturns a \_\_time64_t (LONGLONG) value for the given CTime64 object.
GetYearReturns the year represented by the CTime64 object.
SetDateTimeSets the date and time of this CTime64 object.

CTimeSpan Class

An amount of time, which is internally stored as the number of seconds in the time span.

  • The CTimeSpan methods convert seconds to various combinations of days, hours, minutes, and seconds.
  • The CTimeSpan object is stored in a \_\_time64_t structure, which is 8 bytes.
  • A companion class, CTime64, represents an absolute time.
NameDescription
ConstructorsCreate new CTimeSpan objects initialized to the specified value.
CAST OperatorReturns the CTimeSpan value as a long integer.
LET OperatorAssigns a value to a CTimeSpan object.
OperatorsAdds, subtracts or compares CTimeSpan objects.
GetDaysReturns a value that represents the number of days in this CTimeSpan.
GetHoursReturns a value that represents the number of hours in the current day (–23 through 23).
GetMinutesReturns a value that represents the number of minutes in the current hour (–59 through 59).
GetSecondsReturns a value that represents the number of seconds in the current hour (–59 through 59).
GetTimeSpanReturns the underlying time value from this CTimeSpan object.
GetTotalHoursReturns a value that represents the total number of complete hours in this CTimeSpan.
GetTotalMinutesReturns a value that represents the total number of complete minutes in this CTimeSpan.
GetTotalSecondsRetrieves this date/time-span value expressed in seconds.
SetTimeSpanSets the value of this date/time-span value.

Constructors (CTime64)

Create new CTime64 objects initialized to the specified value.

CONSTRUCTOR CTime64
CONSTRUCTOR CTime64 (BYVAL timeSrc AS LONGLONG)
CONSTRUCTOR CTime64 (BYREF systimeSrc AS SYSTEMTIME)
CONSTRUCTOR CTime64 (BYREF filetimeSrc AS FILETIME)
CONSTRUCTOR CTime64 (BYVAL nYear AS LONG, BYVAL nMonth AS LONG, BYVAL nDay AS LONG, _
   BYVAL nHour AS LONG, BYVAL nMin AS LONG, BYVAL nSec AS LONG)
ParameterDescription
timeSrcA \_\_time64_t (LONGLONG) value.
systimeSrcA SYSTEMTIME structure to be converted to a \_\_time64_t (LONGLONG) value and copied into the new CTime64 object.
filetimeSrcA FILETIME structure to be converted to a \_\_time64_t (LONGLONG) value and copied into the new CTime64 object. Note that FILETIME uses Universal Coordinated Time (UTC), so if you pass a local time in the structure, your results will be incorrect.
nYear / nMonth / nDay / nHour / nMin / nSecIndicates the date and time values to be copied into the new CTime64 object.
Examples

Initializes a CTime64 object from an existing \_\_time64_t value.

DIM ct1 AS CTime64 = CTime64().GetCurrentTime()
DIM ct2 AS CTime64 = ct1.GetTime

Note: You can also use DIM ct2 AS CTime64 = ct1

Initializes a CTime64 object from individual date/time values.

' // Year = 2017, Month = 10 (October), Day = 9, Hour = 11, Minutes = 32, Seconds = 45
DIM ct AS CTime64 = CTime64(2017, 10, 9, 11, 32, 45)

Initializes a CTime64 object from a SYSTEMTIME structure.

' // Year = 2017, Month = 10 (October), Day = 9, Hour = 11, Minutes = 32, Seconds = 45
DIM st AS SYSTEMTIME 
st.wYear = 2017
st.wMonth = 10
st.wDayOfWeek = 0
st.wDay = 9
st.wHour = 11
st.wMinute = 32
st.wSecond = 45
st.wMilliseconds = 0
' --or--
DIM st AS SYSTEMTIME = (2017, 10, 0, 9, 11, 32, 45, 0)
DIM ct AS CTime64 = st
' --or--
DIM ct AS CTime64
ct.SetDateTime(2017, 10, 9, 11, 32, 45)
DIM st AS SYSTEMTIME = ct.GetAsSystemtime
DIM ct2 AS CTime64 = st
' --or--
DIM ct AS CTime64
ct.SetDateTime(2017, 10, 9, 11, 32, 45)
DIM ct2 AS CTime64 = ct.GetAsSystemtime

CAST Operator (CTime64)

Returns the underlying value from this CTime64 object.

OPERATOR CAST () AS LONGLONG

LET Operator (=) (CTime64)

Assigns a value to a CTime64 object.

OPERATOR LET (BYVAL timeSrc AS LONGLONG)
OPERATOR LET (BYREF st AS SYSTEMTIME)
OPERATOR LET (BYREF ft AS FILETIME)
ParameterDescription
timeSrcA \_\_time64_t (LONGLONG) value.
stA SYSTEMTIME structure to be converted to a \_\_time64_t (LONGLONG) value and copied into the new CTime64 object.
ftA FILETIME structure to be converted to a \_\_time64_t (LONGLONG) value and copied into the new CTime64 object. Note that FILETIME uses Universal Coordinated Time (UTC), so if you pass a local time in the structure, your results will be incorrect.

Operators (CTime64)

Adds, subtracts or compares CTime64 objects.

OPERATOR + (BYREF dt AS CTime64, BYREF dateSpan AS CTimeSpan) AS CTime64
OPERATOR - (BYREF dt AS CTime64, BYREF dateSpan AS CTimeSpan) AS CTime64
OPERATOR - (BYREF dt1 AS CTime64, BYREF dt2 AS CTime64) AS CTimeSpan
OPERATOR += (BYREF dateSpan AS CTimeSpan)
OPERATOR -= (BYREF dateSpan AS CTimeSpan)
OPERATOR = (BYREF dt1 AS CTime64, BYREF dt2 AS CTime64) AS BOOLEAN
OPERATOR <> (BYREF dt1 AS CTime64, BYREF dt2 AS CTime64) AS BOOLEAN
OPERATOR < (BYREF dt1 AS CTime64, BYREF dt2 AS CTime64) AS BOOLEAN
OPERATOR > (BYREF dt1 AS CTime64, BYREF dt2 AS CTime64) AS BOOLEAN
OPERATOR <= (BYREF dt1 AS CTime64, BYREF dt2 AS CTime64) AS BOOLEAN
OPERATOR >= (BYREF dt1 AS CTime64, BYREF dt2 AS CTime64) AS BOOLEAN
Remarks
+ Adds a CTimeSpan object to a CTime64 object.
- Subtracts a CTimeSpan object from a CTime64 object.
- Subtracts a CTime64 object from another CTime64 object.
+= Adds a CTimeSpan object to this CTime64 object.
-= Subtracts a CTimeSpan object from this CTime64 object.

Format / FormatGmt (CTime64)

Converts a CTime64 object to a string.

FUNCTION Format (BYREF wszFmt AS WSTRING) AS DWSTRING
FUNCTION FormatGmt (BYREF wszFmt AS WSTRING) AS DWSTRING

Formatting codes:

CodeMeaning
%aAbbreviated weekday name
%AFull weekday name
%bAbbreviated month name
%BFull month name
%cDate and time representation appropriate for locale
%dDay of month as decimal number (01 – 31)
%HHour in 24-hour format (00 – 23)
%IHour in 12-hour format (01 – 12)
%jDay of year as decimal number (001 – 366)
%mMonth as decimal number (01 – 12)
%MMinute as decimal number (00 – 59)
%pCurrent locale's A.M./P.M. indicator for 12-hour clock
%SSecond as decimal number (00 – 59)
%UWeek of year as decimal number, with Sunday as first day of week (00 – 53)
%wWeekday as decimal number (0 – 6; Sunday is 0)
%WWeek of year as decimal number, with Monday as first day of week (00 – 53)
%xDate representation for current locale
%XTime representation for current locale
%yYear without century, as decimal number (00 – 99)
%YYear with century, as decimal number
%z, %ZEither the time-zone name or time zone abbreviation, depending on registry settings; no characters if time zone is unknown
%%Percent sign

The # flag may prefix any formatting code. In that case, the meaning of the format code is changed as follows.

  • %#a, %#A, %#b, %#B, %#p, %#X, %#z, %#Z, %#%: # flag is ignored.
  • %#c: Long date and time representation, appropriate for current locale. For example: "Tuesday, March 14, 1995, 12:41:29".
  • %#x* Long date representation, appropriate to current locale. For example: "Tuesday, March 14, 1995".
  • %#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y: Remove leading zeros (if any).
Remarks

Formats the value by using the format string which contains special formatting codes that are preceded by a percent sign (%).

Format uses the local time and FormatGmt the Gmt time.

Examples
print ct.Format("%A, %B %d, %Y %H:%M:%S")
print ct.FormatGmt("%A, %B %d, %Y %H:%M:%S")

GetAsFileTime (CTime64)

Converts the time information stored in the CTime64 object to a Win32–compatible FILETIME structure. A FILETIME structure contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

FUNCTION GetAsFileTime () AS FILETIME

GetAsSystemTime (CTime64)

Converts the time information stored in the CTime64 object to a Win32–compatible SYSTEMTIME structure.

FUNCTION GetAsSystemTime () AS SYSTEMTIME

GetCurrentTime (CTime64)

Returns a CTime64 object that represents the current time.

FUNCTION GetCurrentTime () AS CTime64

GetDay (CTime64)

Returns the day represented by the CTime64 object.

FUNCTION GetDay () AS LONG
Example
DIM ct AS CTime64
ct = ct.GetTime
PRINT ct.GetDay

GetDayOfWeek (CTime64)

Returns the day of the week represented by the CTime64 object.

FUNCTION GetDayOfWeek () AS LONG
Example
DIM ct AS CTime64
ct = ct.GetTime
PRINT ct.GetDayOfWeek

GetGmtTime (CTime64)

Gets a tm structure that contains a decomposition of the time contained in this CTime64 object.

FUNCTION GetGmtTime () AS tm
Remarks

The fields of the structure type tm store the following values, each of which is an integer:

tm_sec : Seconds after minute (0 – 59).
tm_min : Minutes after hour (0 – 59).
tm_hour : Hours after midnight (0 – 23).
tm_mday : Day of month (1 – 31).
tm_mon : Month (0 – 11; January = 0).
tm_year : Year (current year minus 1900).
tm_wday : Day of week (0 – 6; Sunday = 0).
tm_yday : Day of year (0 – 365; January 1 = 0).
tm_isdst : Positive value if daylight saving time is in effect; 0 if daylight saving time is not in effect; negative value if status of daylight saving time is unknown.


GetHour (CTime64)

Returns the hour represented by the CTime64 object.

FUNCTION GetHour () AS LONG
Example
DIM ct AS CTime64
ct = ct.GetTime
PRINT ct.GetHour

GetLocalTime (CTime64)

Gets a tm structure that contains a decomposition of the time contained in this CTime64 object.

FUNCTION GetLocalTime () AS tm
Remarks

The fields of the structure type tm store the following values, each of which is an integer:

tm_sec : Seconds after minute (0 – 59).
tm_min : Minutes after hour (0 – 59).
tm_hour : Hours after midnight (0 – 23).
tm_mday : Day of month (1 – 31).
tm_mon : Month (0 – 11; January = 0).
tm_year : Year (current year minus 1900).
tm_wday : Day of week (0 – 6; Sunday = 0).
tm_yday : Day of year (0 – 365; January 1 = 0).
tm_isdst : Positive value if daylight saving time is in effect; 0 if daylight saving time is not in effect; negative value if status of daylight saving time is unknown.


GetMinute (CTime64)

Returns the minute represented by the CTime64 object.

FUNCTION GetMinute () AS LONG
Example
DIM ct AS CTime64
ct = ct.GetTime
PRINT ct.GetMinute

GetMonth (CTime64)

Returns the month represented by the CTime64 object.

FUNCTION GetMonth () AS LONG
Example
DIM ct AS CTime64
ct = ct.GetTime
PRINT ct.GetMonth

GetSecond (CTime64)

Returns the second represented by the CTime64 object.

FUNCTION GetSecond () AS LONG
Example
DIM ct AS CTime64
ct = ct.GetTime
PRINT ct.GetSecond

GetTime (CTime64)

Returns a \_\_time64_t (LONGLONG) value for the given CTime64 object.

FUNCTION GetTime () AS LONGLONG
Example
DIM ct AS CTime64
ct = ct.GetTime

GetYear (CTime64)

Returns the year represented by the CTime64 object.

FUNCTION GetYear () AS LONG
Example
DIM ct AS CTime64
ct = ct.GetTime
PRINT ct.GetYear

SetDateTime (CTime64)

Sets the date and time of this CTime64 object.

FUNCTION SetDateTime (BYVAL nYear AS WORD, BYVAL nMonth AS WORD, BYVAL nDay AS WORD, _
   BYVAL nHour AS WORD = 0, BYVAL nMin AS WORD = 0, BYVAL nSec AS WORD = 0) AS BOOLEAN
ParameterDescription
nYearThe year (1970-3000).
nMonthThe month (1-12).
nDayThe day (1-31).
nHourThe hour (0-23).
nMinuteThe minutes (0-59).
nHourThe seconds (0-59).
Example
' // Year = 2017, Month = 10 (October), Day = 9, Hour = 11, Minutes = 32, Seconds = 45
DIM ct AS CTime64 = CTime64(2017, 10, 9, 11, 32, 45)

Constructors (CTimeSpan)

Create new CTimespan objects initialized to the specified value.

CONSTRUCTOR CTimeSpan
CONSTRUCTOR CTimeSpan (BYVAL lltime AS LONGLONG)
CONSTRUCTOR CTimeSpan (BYVAL lDays AS LONG, BYVAL nHours AS LONG, BYVAL nMins AS LONG, BYVAL nSecs AS LONG)
ParameterDescription
lltimeA \_\_time64_t (LONGLONG) value.
lDays / nHours / nMins / nSecsIndicates the day and time values to be copied into the new CTimeSpan object.

CAST Operator (CTimeSpan)

Returns the underlying value from this CTimeSpan object.

OPERATOR CAST () AS LONGLONG

LET Operator (=) (CTimeSpan)

Assigns a value to a CTimeSpan object.

OPERATOR LET (BYVAL nSpan AS LONGLONG)
OPERATOR LET (BYREF cSpan AS CTimeSpan)
ParameterDescription
nSpanA \_\_time64_t (LONGLONG) value.
cSpanA CTimeSpan object.

Operators (CTimeSpan)

Adds, subtracts or compares CTimeSpan objects.

OPERATOR + (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS CTime64
OPERATOR - (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS CTime64
OPERATOR - (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS CTimeSpan
OPERATOR += (BYREF cSpan AS CTimeSpan)
OPERATOR -= (BYREF cSpan AS CTimeSpan)
OPERATOR = (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS BOOLEAN
OPERATOR <> (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS BOOLEAN
OPERATOR < (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS BOOLEAN
OPERATOR > (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS BOOLEAN
OPERATOR <= (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS BOOLEAN
OPERATOR >= (BYREF cSpan1 AS CTimeSpan, BYREF cSpan2 AS CTimeSpan) AS BOOLEAN
Remarks
+ Adds a CTimeSpan value to another CTimeSpan object.
- Subtracts a CTimeSpan value from another CTimeSpan object.
+= Adds a CTimeSpan value to this CTimeSpan object.
-= Subtracts a CTimeSpan value from this CTimeSpan object.

GetDays (CTimeSpan)

Returns a value that represents the number of days in this CTimeSpan.

FUNCTION GetDays () AS LONG

GetHours (CTimeSpan)

Returns a value that represents the number of hours in the current day (–23 through 23).

FUNCTION GetHours () AS LONG

GetMinutes (CTimeSpan)

Returns a value that represents the number of minutes in the current hour (–59 through 59).

FUNCTION GetMinutes () AS LONG

GetSeconds (CTimeSpan)

Returns a value that represents the number of seconds in the current hour (–59 through 59).

FUNCTION GetSeconds () AS LONG

GetTimeSpan (CTimeSpan)

Returns the underlying time value from this CTimeSpan object.

FUNCTION GetTimespan () AS LONG

GetTotalHours (CTimeSpan)

Returns a value that represents the total number of complete hours in this CTimeSpan.

FUNCTION GetTotalHours () AS LONG

GetTotalMinutes (CTimeSpan)

Returns a value that represents the total number of complete minutes in this CTimeSpan.

FUNCTION GetTotalMinutes () AS LONG

GetTotalSeconds (CTimeSpan)

Retrieves this date/time-span value expressed in seconds.

FUNCTION GetTotalSeconds () AS LONG

SetTimeSpan (CTimeSpan)

Sets the value of this date/time-span value.

SUB SetTimeSpan (BYVAL lltime AS LONGLONG)
SUB SetTimeSpan (BYVAL lDays AS LONG, BYVAL nHours AS LONG, BYVAL nMins AS LONG, BYVAL nSecs AS LONG)
ParameterDescription
lltimeA \_\_time64_t (LONGLONG) value.
lDays / nHours / nMins / nSecsIndicates the day and time values to be copied into the CTimeSpan object.