本文整理汇总了C++中COleDateTime类的典型用法代码示例。如果您正苦于以下问题:C++ COleDateTime类的具体用法?C++ COleDateTime怎么用?C++ COleDateTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了COleDateTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateData
void CExtIdDetail::OnKillfocusEndDateEdit()
{
UpdateData(TRUE);
int valid = ABP_FAILURE;
valid = validate_date( m_eEndDate, "End Date" );
// check to see if from time < to time
if( valid == ABP_SUCCESS )
{
COleDateTime CheckStartTime;
COleDateTime CheckEndTime;
CString sStartDate;
CString sEndDate;
m_eStartDate.GetWindowText(sStartDate);
m_eEndDate.GetWindowText(sEndDate);
if( !sStartDate.IsEmpty() && !sEndDate.IsEmpty() )
{
// parse the date string.....
CheckStartTime.ParseDateTime( sStartDate, VAR_DATEVALUEONLY, LANG_USER_DEFAULT );
CheckEndTime.ParseDateTime( sEndDate, VAR_DATEVALUEONLY, LANG_USER_DEFAULT );
if( CheckStartTime > CheckEndTime )
{
Beep( 400, 100 );
CGuiMsg::GuiMessage( GUIMSG_END_DATE_AFTER_START_DATE );
m_eEndDate.SetWindowText("");
UpdateData(FALSE);
}
}
}
}
示例2: SetFirstDayOfWeek
void CMiniCalendarCtrl::SetFirstDayOfWeek(int _iDayOfWeek)
{
if (_iDayOfWeek > 0 && _iDayOfWeek <= 7)
{
m_iFirstDayOfWeek = _iDayOfWeek;
COleDateTime dtTemp;
CCalendarUtils::GetToday(dtTemp);
// find the specified day of the week
while (dtTemp.GetDayOfWeek() != _iDayOfWeek)
{
dtTemp += 1;
}
for (int iX = 0; iX < 7; iX++)
{
CString strName = CCalendarUtils::GetWeekday(iX, 1);
//if (!Misc::IsMultibyteString(strName))
{
//not multibyte - only want first character of this string
strName = strName.Left(1);
}
m_arrShortDayOfWeekNames[iX] = strName;
dtTemp += 1;
}
}
else
{
ASSERT(FALSE);
}
}
示例3: AfxMessageBox
/******************************************************************************
* ++
* Method name : CServerLogView::OnBnClickedFindButton()
* Description : Function load data need to find to listview button
* Parameters : NULL
* Return values : NULL
*
* --
*****************************************************************************/
void CServerLogView::OnBnClickedFindButton()
{
// TODO: Add your control notification handler code here
cb_Day.GetWindowText(m_lpszDay);
cb_Month.GetWindowText(m_lpszMonth);
cb_Year.GetWindowText(m_lpszYear);
if(m_lpszYear.GetLength() == 0 || m_lpszMonth.GetLength() == 0 || m_lpszDay.GetLength() == 0)
{
AfxMessageBox("Please choose DateTime");
this->listctrl.DeleteAllItems();
}
else
{
int nYear = atoi(m_lpszYear);
int nMonth = atoi(m_lpszMonth);
int nDay = atoi(m_lpszDay);
COleDateTime cDateTime;
cDateTime.SetDateTime(nYear, nMonth, nDay, 0, 0, 0);
if(!cDateTime.m_status)
{
this->InsertLogFiletoListView(this->m_listlog->GetListLogbyDate(nYear, nMonth, nDay));
}
else
{
AfxMessageBox("DateTime is invalid");
}
}
}
示例4: ASSERT_MESSAGE
bool Cx_CfgRecord::GetDate(const wchar_t* pszEntry, int& year, int& month, int& day)
{
ASSERT_MESSAGE(m_pRs != NULL, "The record is write-only.");
if (m_pRs != NULL)
{
try
{
_variant_t var(m_pRs->GetFields()->GetItem(pszEntry)->GetValue());
COleDateTime dt;
if (DbFunc::GetDate(dt, var))
{
year = dt.GetYear();
month = dt.GetMonth();
day = dt.GetDay();
return true;
}
}
CATCH_DB_STR_ERROR
}
return false;
}
示例5: SetDate
void CXTPPropertyGridItemDate::SetValue(CString strValue)
{
COleDateTime dt;
TRY
{
if (ParseDateTime(dt, strValue))
{
SetDate(dt);
}
else if (dt.ParseDateTime(strValue, VAR_DATEVALUEONLY))
{
SetDate(dt);
}
else if (!m_strNullValue.IsEmpty())
{
COleDateTime dtNull;
dtNull.SetStatus(COleDateTime::null);
SetDate(dtNull);
}
}
CATCH(COleException, e)
{
}
END_CATCH
}
示例6: COleDateTimeSpan
void CNDTermConsumeView::InitData()
{
if (m_cboTermID.GetCount() > 0)
{
return;
}
COleDateTime dtTmp;
if (theApp.GetCurCashier()->IsOnDuty())
{
dtTmp.ParseDateTime(theApp.GetCurCashier()->GetOnDutyTime());
}
else
{
dtTmp = COleDateTime::GetCurrentTime();
dtTmp -= COleDateTimeSpan(1, 0, 0, 0);
}
m_StartTime.SetDate(dtTmp);
dtTmp = COleDateTime::GetCurrentTime();
dtTmp += COleDateTimeSpan(1, 0, 1, 0);
m_EndTime.SetDate(dtTmp);
for (INT i = 0; i < CLocalServer::GetInstance()->ComputerList.GetCount(); i++)
{
m_cboTermID.AddString(CLocalServer::GetInstance()->ComputerList.GetComputer(i).GetTerminalID());
}
}
示例7: ASSERT_VALID
//****************************************************************************************
void CBCGPDateTimeCtrl::BuidWidestDate (CDC* pDC)
{
ASSERT_VALID (pDC);
CBCGPDefaultLocale dl;
//-----------------------
// Find the widest month:
//-----------------------
int iMaxMonth = 1;
if (m_monthFormat == 2) // Numeric
{
iMaxMonth = 9;
}
else
{
int iMaxMonthWidth = 0;
for (int iMonth = 1; iMonth <= 12; iMonth ++)
{
COleDateTime date (1998, iMonth, 1, 0, 0, 0);
CString strMonth = date.Format (m_monthFormat == 0 ? _T ("%b") : _T("%B"));
int iMonthWidth = pDC->GetTextExtent (strMonth).cx;
if (iMonthWidth > iMaxMonthWidth)
{
iMaxMonthWidth = iMonthWidth;
iMaxMonth = iMonth;
}
}
}
m_WidestDate = COleDateTime (2000, iMaxMonth, 20, 0, 0, 0);
}
示例8: CheckTakeUp
BOOL CNDCheckInDlg::CheckTakeUp(CString strTermId)
{
//查询该终端是否被占用
BOOL bTakeUp = FALSE;
CLastUserInfo LastUserInfo;
if (CIBADAL::GetInstance()->GetLastUserInfo(LastUserInfo, 0, strTermId))
{
if (LastUserInfo.GetSuspend())//挂机
{
bTakeUp = TRUE;
}
else//非挂机
{
COleDateTime updateTime;
updateTime.ParseDateTime(LastUserInfo.GetUpdateTime());
COleDateTimeSpan interval = COleDateTime::GetCurrentTime() - updateTime;
if (interval.GetTotalMinutes() < 10)//被占用,并且用户还有效
{
bTakeUp = TRUE;
}
}
}
return bTakeUp;
}
示例9: FormatDateTime
CString FormatDateTime ( COleDateTime &DateTime, LPCTSTR pFormat )
{
// If null, return empty string
if ( DateTime.GetStatus() == COleDateTime::null || DateTime.GetStatus() == COleDateTime::invalid )
return _T("");
UDATE ud;
if (S_OK != VarUdateFromDate(DateTime.m_dt, 0, &ud))
{
return _T("");
}
TCHAR *weeks[]={_T("Sun"),_T("Mon"),_T("Tue"),_T("Wen"),_T("Thu"),_T("Fri"),_T("Sat")};
TCHAR *month[]={_T("JAN"),_T("FEB"),_T("MAR"),_T("APR"),
_T("MAY"),_T("JUN"),_T("JUL"),_T("AUG"),
_T("SEP"),_T("OCT"),_T("NOV"),_T("DEC")};
TIME_ZONE_INFORMATION stTimeZone;
GetTimeZoneInformation(&stTimeZone);
CString strDate;
strDate.Format(_T("%s, %d %s %02d %d:%d:%d %c%04d")
,weeks[ud.st.wDayOfWeek],
ud.st.wDay,month[ud.st.wMonth-1],ud.st.wYear%100,ud.st.wHour,
ud.st.wMinute,ud.st.wSecond,
stTimeZone.Bias>0?_T('-'):_T('+'),
abs(stTimeZone.Bias*10/6)
);
return strDate;
}
示例10: dt
void CBCGPRecurrenceRuleWeekly::CorrectStart ()
{
COleDateTime dt (GetDateStart ());
int nWD = dt.GetDayOfWeek () - 1;
int nWDS = TypeToDayOfWeek (GetStartDay ()) - 1;
if (nWD == 0)
{
nWD = 7;
}
if (nWDS == 0)
{
nWDS = 7;
}
if (nWD != nWDS)
{
int delta = nWDS - nWD;
if (delta < 0)
{
delta += 7;
}
dt += COleDateTimeSpan (delta, 0, 0, 0);
}
if (dt != GetDateStart ())
{
SetDateStart (dt);
}
}
示例11: DATETimestampToStevesTimestampStrings
///////////////////////////////////////////////////////////////////////////
// Name: DATETimestampToStevesTimestampStrings
//
// Description:
// Convert the DATE timestamp to the two formats expected for the IR table strings
// 1234519970103093456000 and yyyymmdd - xx:xx:xx
//
// Declaration:
// CString CMyDateTime::DATETimestampToStevesDateAndTime(const DATE dTimestamp)
//
// Input: Timestamp - DATE timestamp to convert
//
// Output: none
//
// Return: CString - Date/Time expressed in IR format of yyyymmdd - xx:xx:xx
//
// date / author revision
// ----------------- --------
// 01-Jun-2002 SFK Created from MyDoubleTimestampToStevesDateAndTime in OleTimeUtils.cpp
// 05-May-2003 SFK Fixed to actually return strings formed.
// 20-May-2003 SFK Fixed to return correctly formatted year in szStrFormat1
//////////////////////////////////////////////////////////////////
void CMyDateTime::DATETimestampToStevesTimestampStrings(const DATE dTimestamp, char *szStrFormat1, char *szStrFormat2)
{
CString strTemp1, strTemp2;
COleDateTime DateTime;
char szTime[STEVES_TIMESTAMP_LEN+1], szDate[STEVES_TIMESTAMP_LEN+1];
DateTime.m_dt = dTimestamp;
DATETimestampToDateTimeStrs(dTimestamp, szDate, szTime);
szDate[2] = '\0';
int iYear = atoi(szDate);
//if (iYear < 52) iYear +=20;
//else iYear += 19;
if (iYear < 52) iYear =20;
else iYear = 19;
szDate[5] = '\0';
szTime[2] = '\0';
szTime[5] = '\0';
strTemp1.Format("00000%2d%s%s%s%s%s%s000", iYear, &szDate[0], &szDate[3], &szDate[6],
&szTime[0], &szTime[3], &szTime[6]);
strTemp2 = DateTime.Format("%Y.%m.%d - %H:%M:%S");
strcpy(szStrFormat1, strTemp1.GetBuffer(strTemp1.GetLength())); // sfk 5/15/2003
strcpy(szStrFormat2, strTemp2.GetBuffer(strTemp2.GetLength())); // sfk 5/15/2003
}
示例12: LPTSTR
int CExtIdDetail::validate_date( CEdit &EditDate, LPTSTR(VarName) )
{
CString DateString;
EditDate.GetWindowText(DateString);
// does some nifty date time validation things.....
COleDateTime CheckTime;
enum COleDateTime::DateTimeStatus InputDateStatus;
int status = ABP_SUCCESS;
CString ErrorMsg;
if( !DateString.IsEmpty() )
{
CheckTime.SetTime( 0, 0, 0);
// parse the date string.....
CheckTime.ParseDateTime( DateString, VAR_DATEVALUEONLY, LANG_USER_DEFAULT );
// check for a valid date...
InputDateStatus = CheckTime.GetStatus();
if( InputDateStatus == COleDateTime::invalid ) // invalid date
{
CGuiMsg::GuiMessage(GUIMSG_DATE_INVALID);
DateString.Empty();
EditDate.SetWindowText(DateString);
UpdateData(FALSE);
status = ABP_FAILURE;
}
}
return status;
}
示例13: UpdateData
// after focus moves...validate date for the ToDate CString var
void CNotesDlg::OnKillfocusNoteDateToTxt()
{
UpdateData(TRUE);
int valid = ABP_FAILURE;
valid = validate_date( m_sDateTo, "ToDate" );
// check to see if from time < to time
if( valid == ABP_SUCCESS )
{
COleDateTime CheckFromTime;
COleDateTime CheckToTime;
if( !m_sDateFrom.IsEmpty() && !m_sDateTo.IsEmpty() )
{
// parse the date string.....
CheckFromTime.ParseDateTime( m_sDateFrom, VAR_DATEVALUEONLY, LCID_ENGLISH );
CheckToTime.ParseDateTime( m_sDateTo, VAR_DATEVALUEONLY, LCID_ENGLISH );
if( CheckFromTime > CheckToTime )
{
Beep( 400, 100 );
CGuiMsg::GuiMessage( GUIMSG_DATE_TO_BEFORE_FROM_DATE );
m_sDateTo.Empty();
UpdateData(FALSE);
}
}
}
}
示例14: processLog
void CWizSync::startDownloadObjectsData()
{
Q_EMIT processLog(tr("downloading objects data"));
Q_EMIT progressChanged(progressAttachmentUploaded);
m_db.GetAllObjectsNeedToBeDownloaded(m_arrayAllObjectsNeedToBeDownloaded);
if (!m_bDownloadAllNotesData)
{
COleDateTime tNow = ::WizGetCurrentTime();
size_t count = m_arrayAllObjectsNeedToBeDownloaded.size();
for (intptr_t i = count - 1; i >= 0; i--)
{
COleDateTime t = m_arrayAllObjectsNeedToBeDownloaded[i].tTime;
t = t.addDays(7);
if (t < tNow)
{
m_arrayAllObjectsNeedToBeDownloaded.erase(m_arrayAllObjectsNeedToBeDownloaded.begin() + i);
continue;
}
if (m_arrayAllObjectsNeedToBeDownloaded[i].eObjectType == wizobjectDocumentAttachment)
{
m_arrayAllObjectsNeedToBeDownloaded.erase(m_arrayAllObjectsNeedToBeDownloaded.begin() + i);
continue;
}
}
}
downloadNextObjectData();
}
示例15: mesage_SetPathValue
int mesage_SetPathValue(lua_State* L)
{
CString type = luaL_typename(L,3);
if(type == "string")
{
CString str = luaL_checkstring(L,3);
COleDateTime dt;
if(dt.ParseDateTime(str))
{
cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(dt));
}else{
cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(str));
}
}else if(type == "number")
{
cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(luaL_checknumber(L,3)));
}else if(type == "boolean")
{
VARIANT var;
var.vt = VT_BOOL;
var.boolVal = (lua_toboolean(L,3)==1);
cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),var);
}else if(type == "nil")
{
VARIANT var;
var.vt = VT_NULL;
cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),var);
}else
{
throw_L_error(L, "Invalid type of value");
}
return 0;
}