本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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
}
示例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();
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}