当前位置: 首页>>代码示例>>C++>>正文


C++ COleDateTime::GetDay方法代码示例

本文整理汇总了C++中COleDateTime::GetDay方法的典型用法代码示例。如果您正苦于以下问题:C++ COleDateTime::GetDay方法的具体用法?C++ COleDateTime::GetDay怎么用?C++ COleDateTime::GetDay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COleDateTime的用法示例。


在下文中一共展示了COleDateTime::GetDay方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Format

CString CXTPPropertyGridItemDate::Format(const COleDateTime& oleDate)
{
	if (oleDate.GetStatus() != COleDateTime::valid)
		return _T("");

#if _MSC_VER > 1310
	if (oleDate.GetYear() <= 1900) // Visual Studio 2005 bug.
	{
		CString strDate;
		if (m_strFormat == _T("%d/%m/%Y"))
		{
			strDate.Format(_T("%.2i/%.2i/%.4i"), oleDate.GetDay(), oleDate.GetMonth(), oleDate.GetYear());
			return strDate;
		}
		if (m_strFormat == _T("%m/%d/%Y"))
		{
			strDate.Format(_T("%.2i/%.2i/%.4i"), oleDate.GetMonth(), oleDate.GetDay(), oleDate.GetYear());
			return strDate;
		}
	}
#endif
	if (m_strFormat.IsEmpty())
		return oleDate.Format();

	return oleDate.Format(m_strFormat);
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:26,代码来源:XTPPropertyGridItemExt.cpp

示例2: GetUrlCacheInfo

bool CSmartCache::GetUrlCacheInfo(LPCTSTR pstrURL)
{
	DWORD dwEntrySize = sizeof(INTERNET_CACHE_ENTRY_INFO);
	INTERNET_CACHE_ENTRY_INFO* pCacheEntryInfo = NULL;
	if (!(pCacheEntryInfo = AllocateCacheEntry(pCacheEntryInfo, dwEntrySize)))
		return false;

	bool bDone = false;
	while (!bDone && !GetUrlCacheEntryInfoEx(pstrURL, pCacheEntryInfo, &dwEntrySize, NULL, NULL, NULL, NULL))
	{
		if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
		{
			if (!(pCacheEntryInfo = AllocateCacheEntry(pCacheEntryInfo, dwEntrySize)))
				bDone = true;
		}
		else
			bDone = true;
	}

	bool bSuccess = !bDone;
	if (bSuccess)
	{
		COleDateTime SyncTime = pCacheEntryInfo->LastSyncTime;
		CString strSyncDate;
		strSyncDate.Format("%d/%d/%d", SyncTime.GetMonth(), SyncTime.GetDay(), SyncTime.GetYear());
		COleDateTime AccessTime = pCacheEntryInfo->LastAccessTime;
		CString strAccessDate;
		strAccessDate.Format("%d/%d/%d", AccessTime.GetMonth(), AccessTime.GetDay(), AccessTime.GetYear());
	}
	
	delete [] pCacheEntryInfo;
	
	return bSuccess;
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:34,代码来源:SmartCache.cpp

示例3: IsToday

BOOL CXTPDatePickerItemDay::IsToday(COleDateTime &dt)
{
	BOOL bReturn = FALSE;
	COleDateTime dtToday;
	if (m_pControl->GetToday(dtToday))
	{
		if (dt.GetMonth() == dtToday.GetMonth() &&
			dt.GetYear() == dtToday.GetYear() &&
			dt.GetDay() == dtToday.GetDay())
			bReturn = TRUE;
	}

	return bReturn;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:14,代码来源:XTPDatePickerItemDay.cpp

示例4: Time2AdjustedDate

// ///////////////////////////////////////////////////////////////////////////
//
COleDateTime Time2AdjustedDate( const CString& sTime, const COleDateTime& startDate )
{
	int hr,min;
	String2HourMin(sTime, hr, min);

	// If the given time is before the startDate's time, then the target date is one day further
	//
	if ((hr < startDate.GetHour()) || ((hr == startDate.GetHour()) && (min < startDate.GetMinute())))
	{
		COleDateTime dt = startDate + COleDateTimeSpan(1,0,0,0);
		return COleDateTime(dt.GetYear(), dt.GetMonth(), dt.GetDay(), hr, min, 0);
	}

	return COleDateTime(startDate.GetYear(), startDate.GetMonth(), startDate.GetDay(), hr, min, 0);
}
开发者ID:lbrucher,项目名称:timelis,代码行数:17,代码来源:Utils.cpp

示例5: SetTimeOfDate

// ///////////////////////////////////////////////////////////////////////////
// Build a new date object  by copying the given date object and replacing
// its time by the given one
//
COleDateTime SetTimeOfDate( const COleDateTime& date, const CString& sTime )
{
	int hr,min;
	String2HourMin(sTime, hr, min);

	return COleDateTime(date.GetYear(), date.GetMonth(), date.GetDay(), hr, min, 0);
}
开发者ID:lbrucher,项目名称:timelis,代码行数:11,代码来源:Utils.cpp

示例6: atoi

CDBField& CDBField::operator =( const LPCTSTR szVal )
{
	switch( m_dwType ) {
	case	DBVT_NULL:
			//	Undefined data type
			ASSERT( FALSE );

	case	DBVT_BOOL:
			m_boolVal = (szVal != NULL || atoi( szVal ) != 0 );
			return	*this;

	case	DBVT_UCHAR:
			m_chVal = (unsigned char)szVal[0];
			return	*this;

	case	DBVT_SHORT:
			m_iVal = (short)atoi( szVal );
			return	*this;

	case	DBVT_LONG:
			m_lVal = (long)atol( szVal );
			return	*this;

	case	DBVT_SINGLE:
			m_fltVal = (float)atof( szVal );
			return	*this;

	case	DBVT_DOUBLE:
			m_dblVal = (double)atof( szVal );
			return	*this;

	case	DBVT_DATE:
		{
			ASSERT( m_pdate != NULL );
			COleDateTime	dt;
			dt.ParseDateTime( szVal );
			m_pdate->year	= dt.GetYear();
			m_pdate->month	= dt.GetMonth();
			m_pdate->day	= dt.GetDay();
			m_pdate->hour	= dt.GetHour();
			m_pdate->minute	= dt.GetMinute();
			m_pdate->second = dt.GetSecond();
			m_pdate->fraction = 0;
			return	*this;
		}

	case	DBVT_STRING:
			ASSERT( m_pstring != NULL );
			*m_pstring = szVal;
			return	*this;

	case	DBVT_BINARY:
			//	CRecordset does not support writing to CLongBinary fields
			ASSERT( FALSE );
			return	*this;
	}
	//	Undefined data type
	ASSERT( FALSE );
	return	*this;
}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:60,代码来源:ODBCRecordset.cpp

示例7: ConvertToDateTime

NET_TIME CDevByFileDlg::ConvertToDateTime(const COleDateTime &date, const CTime &time)
{
	NET_TIME netTime = {0};
	int year = date.GetYear();
	if (year < 2000)
	{
		netTime.dwYear = 2000;
		netTime.dwMonth = 1;
		netTime.dwDay = 1;
		netTime.dwHour = 0;
		netTime.dwMinute = 0;
		netTime.dwSecond = 0;
	}
	else
	{
		netTime.dwYear = date.GetYear();
		netTime.dwMonth = date.GetMonth();
		netTime.dwDay = date.GetDay();
		netTime.dwHour = time.GetHour();
		netTime.dwMinute = time.GetMinute();
		netTime.dwSecond =time.GetSecond();
	}
	
	return netTime;
}
开发者ID:mk-z,项目名称:Scan,代码行数:25,代码来源:DevByFileDlg.cpp

示例8: IsSilentUpdateAllowed

bool CHpAutoUpdate::IsSilentUpdateAllowed()
{
	CRegKey regkey;
	if (regkey.Open(REGKEY_APPROOT, REGKEY_HPAPP) != ERROR_SUCCESS)
		return true;
	
	DWORD dwSize = MAX_PATH;
	TCHAR szBuffer[MAX_PATH];
	if (regkey.QueryStringValue(REGVAL_AUTOUPDATE, szBuffer, &dwSize) != ERROR_SUCCESS)
		return true;

	COleDateTime Date;
	bool bOK = Date.ParseDateTime(CString(szBuffer), 0/*dwFlags*/);
	if (!bOK)
		return true;

	COleDateTime Now = COleDateTime::GetCurrentTime();
	CString strDate;
	strDate.Format("%d/%d/%d", Now.GetMonth(), Now.GetDay(), Now.GetYear());
	bOK = Now.ParseDateTime(CString(strDate), 0/*dwFlags*/);
	if (!bOK)
		return true;

	return (Date != Now);
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:25,代码来源:HpAutoUpdate.cpp

示例9: CorrectStart

void CBCGPRecurrenceRuleMonthly::CorrectStart ()
{
	COleDateTime dt (GetDateStart ());

	int m = dt.GetMonth ();
	int y = dt.GetYear ();

	int d = GetPossibleDay (m, y);

	if (d < dt.GetDay ())
	{
		m++;

		if (m == 13)
		{
			m = 1;
			y++;
		}

		d = GetPossibleDay (m, y);
	}

	int nDays = CBCGPCalendar::GetMaxMonthDay (m, y);

	dt = COleDateTime (y, m, nDays < d ? nDays : d, 0, 0, 0);

	if (dt != GetDateStart ())
	{
		SetDateStart (dt);
	}
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:31,代码来源:BCGPRecurrenceRules.cpp

示例10: start

// Start the server. This blocks until the server stops.
void AgentConfigurationEx::start()
{
	GLogger.LogMessage(StdStringFormat("AgentConfigurationEx::start()\n"));
	getAgent()->set_listening_port(Globals.HttpPort);
	MTConnectService::setName(Globals.ServerName);

	for(int i=0; i< _ipaddrs.size(); i++)
	{
		COpcAdapter *  _cmdHandler = new COpcAdapter(this, config, _ipaddrs[i], _devices[i], _tags[i]);
		_cncHandlers.push_back(_cmdHandler);
		GLogger.LogMessage(StdStringFormat("AgentConfigurationEx::start COpcAdapter::Cycle() %x\n",_ipaddrs[i]), DBUG);
		_group.create_thread(boost::bind(&COpcAdapter::Cycle, _cncHandlers[i]));
	}
	GLogger.LogMessage(StdStringFormat("Call AgentConfiguration::start() ed \n"));

	if(Globals.ResetAtMidnight)
	{
		COleDateTime now = COleDateTime::GetCurrentTime();
		COleDateTime date2 =  COleDateTime(now.GetYear(), now.GetMonth(), now.GetDay(), 0, 0, 0) +  COleDateTimeSpan(1, 0, 0, 1);
		//COleDateTime date2 =  now +  COleDateTimeSpan(0, 0, 2, 0); // testing reset time - 2 minutes
		COleDateTimeSpan tilmidnight = date2-now;
		_resetthread.Initialize();
		_resetthread.AddTimer(
			(long) tilmidnight.GetTotalSeconds() * 1000,
			&_ResetThread,
			(DWORD_PTR) this,
			&_ResetThread._hTimer  // stored newly created timer handle
			) ;

		GLogger.LogMessage(StdStringFormat("Agent will Reset At Midnight %s \n", (LPCSTR) date2.Format()), DBUG);
	}

	AgentConfiguration::start(); // does not return
}
开发者ID:CubeSpawn-Research,项目名称:MTConnectToolbox,代码行数:35,代码来源:MTCSiemensAgent.cpp

示例11: start

// NOTE: Windows SCM more tolerant of slow starting processes than terminating processes.
void MtcOpcAdapter::start()
{
 	static char name[] = "MtcOpcAdapter::start";
	_bRunning=true; 
	if(_bResetAtMidnight)
	{
		COleDateTime now = COleDateTime::GetCurrentTime();
		COleDateTime date2 =  COleDateTime(now.GetYear(), now.GetMonth(), now.GetDay(), 0, 0, 0) +  COleDateTimeSpan(1, 0, 0, 1);
		//COleDateTime date2 =  now +  COleDateTimeSpan(0, 0, 2, 0); // testing reset time - 2 minutes

		COleDateTimeSpan tilmidnight = date2-now;
		_resetthread.Initialize();
		_resetthread.AddTimer(
			(long) tilmidnight.GetTotalSeconds() * 1000,
			&_ResetThread,
			(DWORD_PTR) this,
			&_ResetThread._hTimer  // stored newly created timer handle
			) ;

		GLogger << INFO << "Adapter will Reset At Midnight " << date2.Format() << std::endl;
	}

	if(_bOPCEnabled)
	{
		_workerthread.Initialize();
		::SetEvent (_StartThread._hEvent); // start OPC thread
		_workerthread.AddHandle(_StartThread._hEvent, &_StartThread,(DWORD_PTR) this);
	}

	// This goes last... never returns
	startServer();
}
开发者ID:CubeSpawn-Research,项目名称:MTConnectToolbox,代码行数:33,代码来源:MtcOpcAdapter.cpp

示例12: GetDateTime

bool Cx_CfgRecord::GetDateTime(const wchar_t* pszEntry, int& year, int& month, int& day, 
                                  int& hour, int& minute, int& second)
{
    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::GetDateTime(dt, var))
            {
                year = dt.GetYear();
                month = dt.GetMonth();
                day = dt.GetDay();
                hour = dt.GetHour();
                minute = dt.GetMinute();
                second = dt.GetSecond();

                return true;
            }
        }
        CATCH_DB_STR_ERROR
    }

    return false;
}
开发者ID:killvxk,项目名称:WebbrowserLock,代码行数:29,代码来源:Cx_CfgRecord.cpp

示例13: while

void CCalendarDlg2::SetTextForDay(SYSTEMTIME* sysTime)
{
    static BOOL bFirst=1;
    static CString sDovesok;
    static COleDateTime dtCurrent;
    if(!bFirst && dtCurrent.GetStatus()!=COleDateTime::invalid) {
        CString sThisDayNKey=Format(sKey,dtCurrent.GetDay(),dtCurrent.GetMonth(),dtCurrent.GetYear());
        CString sCurDay;
        m_eText.GetWindowText(sCurDay);
        sCurDay.TrimLeft();
        sCurDay.TrimRight();
        if(sCurDay!="") {
            sCurDay.Replace("\r\n","\n");
            if(sDovesok!="") {
                sCurDay+=Format("[?CDATA{%s}?DATAC:)]",sDovesok);
            }
            if(!bINewLine) {
                sCurDay.Replace("\n","<br>");
            }
            CString sContent=CString("\n")+sCurDay+"\n";
            while(sContent!="") {
                CString sLine=sContent.SpanExcluding("\n");
                if(sLine!="") {
                    aItems.Add(sThisDayNKey+sLine);
                    if(sContent.GetLength()>sLine.GetLength()) {
                        sContent=sContent.Mid(sLine.GetLength()+1);
                    } else {
                        sContent="";
                    }
                }
                sContent.TrimLeft();
            }
        }
        sDovesok="";
    }
    bFirst=0;
    if(sysTime) {
        COleDateTime dtTime=COleDateTime(sysTime->wYear,sysTime->wMonth,sysTime->wDay,0,0,0);
        char szTmp[256]= {0};
        GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,sysTime,0,szTmp,sizeof(szTmp));
        GetDlgItem(IDC_STATIC3)->SetWindowText(Format("%s: %s",_l("Current date"),szTmp));
        CString sThisDayNKey=Format(sKey,dtTime.GetDay(),dtTime.GetMonth(),dtTime.GetYear());
        dtCurrent=dtTime;
        CString sDayNote;
        for(int i=aItems.GetSize()-1; i>=0; i--) {
            if(aItems[i].Find(sThisDayNKey)==0) {
                if(sDayNote!="") {
                    sDayNote+="\r\n";
                }
                sDayNote+=aItems[i].Mid(sThisDayNKey.GetLength());
                aItems.RemoveAt(i);
            }
        }
        sDovesok=CDataXMLSaver::GetInstringPart("[?CDATA{","}?DATAC:)]",sDayNote);
        sDayNote.Replace(Format("[?CDATA{%s}?DATAC:)]",sDovesok),"");
        sDayNote.Replace("<br>","\r\n");
        m_eText.SetWindowText(sDayNote);
    }
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:59,代码来源:CalendarDlg2.cpp

示例14: GetFormatDate

BOOL CGuiParameter::GetFormatDate(CString& m_szDate, CString Format)
{
	COleDateTime time;
	if (!GetValue(time)) return FALSE;
	CTime ct(time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond()); 
	m_szDate =ct.Format(Format);
	return TRUE;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:8,代码来源:GuiADODB.cpp

示例15: OnNMClickListUser

void CDlgUserManager::OnNMClickListUser(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
	// TODO: 在此添加控件通知处理程序代码
	*pResult = 0;
	if (-1 == pNMItemActivate->iItem) return;

	CString strTem;
	COleDateTime ot;

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,1);
	m_strEditUserName = strTem;

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,2);
	m_strEditPwd = strTem;

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,3);
	ot.ParseDateTime(strTem);
	CTime ti0(ot.GetYear(),ot.GetMonth(),ot.GetDay(),ot.GetHour(),ot.GetMinute(),ot.GetMinute());
	m_regTime.SetTime(&ti0);

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,4);
	
	ot.ParseDateTime(strTem);
	CTime ti(ot.GetYear(),ot.GetMonth(),ot.GetDay(),ot.GetHour(),ot.GetMinute(),ot.GetMinute());
	m_expireDate.SetTime(&ti);

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,5);
	m_strEditCompany = strTem;

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,6);

	for (int i=0;i<sizeof(g_szPowerArray)/sizeof(g_szPowerArray[0]);i++)
	{
		if ( !_tcsicmp(strTem,CString(g_szPowerArray[i]) ) )
		{
			m_comPower.SetCurSel(i);
			break;
		}
	}

	

	UpdateData(FALSE);
}
开发者ID:lipeng260,项目名称:CoalOpener_Matching_System,代码行数:45,代码来源:DlgUserManager.cpp


注:本文中的COleDateTime::GetDay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。