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


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

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


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

示例1: GetNowTime

CTime GetNowTime(short nPeriod)
{
	if(nPeriod == PERIOD_TYPE_DAY)
	{
		CTime now = CTime::GetCurrentTime();
		CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),0,0,0);
		return t;
	}
	else if (nPeriod == PERIOD_TYPE_MINUTE1)
	{
		CTime now = CTime::GetCurrentTime();
		CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),now.GetHour(),now.GetMinute(),0);
		return t;
	}
	else if (nPeriod == PERIOD_TYPE_MINUTE5)
	{
		CTime now = CTime::GetCurrentTime();
		int nMinute = now.GetMinute() / 5 * 5;
		CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),now.GetHour(),nMinute,0);
		return t;
	}
	else
	{
		return CTime::GetCurrentTime();
	}
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:26,代码来源:HSDownloadData.cpp

示例2: OnBnClickedUpdateLyest

void CRecordUpDlg::OnBnClickedUpdateLyest()
{
	// TODO: 在此添加控件通知处理程序代码
	UpdateData(TRUE);

	m_radio = 3;

	CTime ct = CTime::GetCurrentTime();
	// 调时间         日  小时 分钟 秒
	//ct -= CTimeSpan(ct.GetDayOfWeek()-1, 0, 0, 0);
	int m_ny = ct.GetYear();
	int m_nm = ct.GetMonth();
	int m_nd = ct.GetDay();
	ct -= CTimeSpan(1, 0, 0, 0);
	int m_fy = ct.GetYear();
	int m_fm = ct.GetMonth();
	int m_fd = ct.GetDay();

	CString ft, nt, cs;
	ft.Format(_T("'%d-%d-%d'"), m_fy, m_fm, m_fd);
	nt.Format(_T("'%d-%d-%d'"), m_ny, m_nm, m_nd);

	cs = _T("upTime between ");
	cs += ft;
	cs += _T(" and ");
	cs += nt;
	//MessageBox(cs);
	set.m_strFilter = cs;
	ListTheInfo();
}
开发者ID:ZhengzhenZhang,项目名称:course-design,代码行数:30,代码来源:RecordUpDlg.cpp

示例3: GetSetTime

void CDlgAlarmAnalysis::GetSetTime(int* nBegin, int* nEnd)
{
	CTime cTime;
	m_wndBeginTime.GetTime(cTime);
	*nBegin = 1000000 * cTime.GetMonth() + 10000 * cTime.GetDay() + 100 * 0 + 0;
	m_wndEndTime.GetTime(cTime);
	*nEnd = 1000000 * cTime.GetMonth() + 10000 * cTime.GetDay() + 100 * 23 + 59;
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:8,代码来源:DlgAlarmAnalysis.cpp

示例4: WriteLog

BOOL WriteLog(WCHAR *szFile,CTime StartTime,CTime EndTime,BOOL bSucc)
{
	CString strText,strResult;
	WCHAR    szUserName[MAX_PATH],szLogFile[MAX_PATH];
	HANDLE  hFile;
	WORD    wUnicodeSign = 0;
	ULONG	ulEnter = 0x000a000d;
	ULONG	ulLen = MAX_PATH,dwWrtited;

	GetUserName(szUserName,&ulLen);

	strResult.LoadString(bSucc?IDS_RESULT_SUCC:IDS_RESULT_FAIL);
	strText.Format(IDS_LOG_FORMAT,szFile,szUserName,
					StartTime.GetYear(),StartTime.GetMonth(),StartTime.GetDay(),
					StartTime.GetHour(),StartTime.GetMinute(),StartTime.GetSecond(),
					EndTime.GetYear(),EndTime.GetMonth(),EndTime.GetDay(),
					EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond(),
					g_nDelMethod, strResult);

	////GetSystemDirectory(szLogFile,MAX_PATH);
	//ZeroMemory(szLogFile, MAX_PATH * sizeof(WCHAR));
	//WCHAR chCurrentProcessName[MAX_PATH];
	//WCHAR *pDest = NULL;
	//GetModuleFileName(NULL,chCurrentProcessName,MAX_PATH);

	//wcscpy(szLogFile,chCurrentProcessName);
	//pDest = wcsstr(szLogFile,L"\\DelFile.exe");
	//*pDest = L'\0';		
	CString path;
	GetLocalDir(path);
	path += L"\\dm.log";
	//wcscat(szLogFile,L"\\dm.log");
	hFile = CreateFile(path,GENERIC_READ|GENERIC_WRITE,
					 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
					 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
					 NULL);
	if (hFile == INVALID_HANDLE_VALUE)
	{
		strText.Format(IDS_LOG_FAIL,path);
		AfxMessageBox(strText);
		return FALSE;
	}

	ReadFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
	if (wUnicodeSign != 0xfeff)
	{
		wUnicodeSign = 0xfeff;
		SetFilePointer(hFile,0,NULL,FILE_BEGIN);
		WriteFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
	}
	else SetFilePointer(hFile,0,NULL,FILE_END);
	WriteFile(hFile,strText,strText.GetLength()*sizeof(WCHAR),&dwWrtited,NULL);
	WriteFile(hFile,&ulEnter,sizeof(ULONG),&dwWrtited,NULL);
	SetEndOfFile(hFile);
	CloseHandle(hFile);
	return TRUE;
}
开发者ID:xfxf123444,项目名称:japan,代码行数:57,代码来源:Fun.cpp

示例5: SetLoginTime

void CDlgETradeLoginStatus::SetLoginTime(){
	CTime currentTime = CTime::GetCurrentTime();
	CTime timeStartToSet(currentTime.GetYear(), currentTime.GetMonth(), currentTime.GetDay(), 8, 50, 0);
	CTime timeEndToSet(currentTime.GetYear(), currentTime.GetMonth(), currentTime.GetDay(), 15, 30, 0);

	this->timeCtrlStart.SetTime(&timeStartToSet);
	this->timeCtrlEnd.SetTime(&timeEndToSet);
	
	this->checkKeepLogin.SetCheck(loginInfo.GetLoginTime().GetChecker());
}
开发者ID:sanghapark,项目名称:TradingSystem,代码行数:10,代码来源:DlgETradeLoginStatus.cpp

示例6: WriteToFile

void CMainFrame::WriteToFile(CString state)
{
	CString        Temp;
	CSAStatusLog   cs;
    NewTime=CTime::GetCurrentTime();

	if(NewTime.GetDay()!=NowTime.GetDay())
 	{
    NowTime=CTime::GetCurrentTime();
	Temp=cs.GetBaseDir(FilePath);
	if(Temp.IsEmpty()) 
    {
		CString  Tempstr(COleDateTime::GetCurrentTime().Format\
		( "%Y.%m.%d-%H.%M.%S.txt"));
		Temp+=Tempstr;
		FilePath=Temp;

        g_statusLog.Init(FilePath);
 	    g_statusLog.Enable(TRUE);
    }
		else
		{
			CString  Tempstr(COleDateTime::GetCurrentTime().Format\
				( "%Y.%m.%d-%H.%M.%S.txt"));
			//Temp+='\\';
			Temp+=Tempstr;
			FilePath=Temp;
			
			g_statusLog.InitPath(FilePath);
			g_statusLog.Enable(TRUE);
			
		}
	}
	else
	{
		if(FilePath.IsEmpty())
		{
	    CString  Tempstr(COleDateTime::GetCurrentTime().Format\
		( "%Y.%m.%d-%H.%M.%S.txt"));
	//	Temp+='\\';
		Temp+=Tempstr;
		FilePath=Temp;

        g_statusLog.InitPath(FilePath);
 	    g_statusLog.Enable(TRUE);
		}
	}
	if (!g_statusLog.m_bEnable) return;
    g_statusLog.StatusOut(state);
}
开发者ID:liguyu,项目名称:cppexample,代码行数:50,代码来源:MainFrm.cpp

示例7: GetDate

CString GetDate(int offset, BOOL ndHMS)
{
	CString res;
	//SYSTEMTIME st;
	//GetLocalTime(&st);
	CTime st = CTime::GetCurrentTime();
	CTimeSpan span(offset,0,0,0);
	st = st+span;
	if(ndHMS)
		res.Format("%d-%.2d-%.2d %.2d:%.2d:%.2d",st.GetYear(),st.GetMonth(),st.GetDay(),st.GetHour(),st.GetMinute(),st.GetSecond());
	else
		res.Format("%d-%.2d-%.2d",st.GetYear(),st.GetMonth(),st.GetDay());
	return res;
}
开发者ID:anzhsoft,项目名称:Readings,代码行数:14,代码来源:StdAfx.cpp

示例8: WriteLog

BOOL WriteLog(WCHAR *szFile,CTime StartTime,CTime EndTime,BOOL bSucc)
{
	CString strText,strResult;
	WCHAR    szUserName[MAX_PATH];
	CString szLogFile;
	HANDLE  hFile;
	WORD    wUnicodeSign = 0;
	ULONG	ulEnter = 0x000a000d;
	ULONG	ulLen = MAX_PATH,dwWrtited;

	GetUserName(szUserName,&ulLen);

	strResult.LoadString(bSucc?IDS_RESULT_SUCC:IDS_RESULT_FAIL);
	strText.Format(IDS_LOG_FORMAT,szFile,szUserName,
					StartTime.GetYear(),StartTime.GetMonth(),StartTime.GetDay(),
					StartTime.GetHour(),StartTime.GetMinute(),StartTime.GetSecond(),
					EndTime.GetYear(),EndTime.GetMonth(),EndTime.GetDay(),
					EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond(),
					strResult);

	//GetSystemDirectory(szLogFile,MAX_PATH);
	GetLocalDir(szLogFile);
	szLogFile += L"\\dm.log";

	hFile = CreateFile(szLogFile,GENERIC_READ|GENERIC_WRITE,
					 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
					 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
					 NULL);
	if (hFile == INVALID_HANDLE_VALUE)
	{
		strText.Format(IDS_LOG_FAIL,szLogFile);
		AfxMessageBox(strText);
		return FALSE;
	}

	ReadFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
	if (wUnicodeSign != 0xfeff)
	{
		wUnicodeSign = 0xfeff;
		SetFilePointer(hFile,0,NULL,FILE_BEGIN);
		WriteFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
	}
	else SetFilePointer(hFile,0,NULL,FILE_END);
	WriteFile(hFile,strText.GetBuffer(0),strText.GetLength()*sizeof(WCHAR),&dwWrtited,NULL);
	WriteFile(hFile,&ulEnter,sizeof(ULONG),&dwWrtited,NULL);
	SetEndOfFile(hFile);
	CloseHandle(hFile);
	return TRUE;
}
开发者ID:xfxf123444,项目名称:japan,代码行数:49,代码来源:Fun.cpp

示例9: GetMyCurrentTime

void CPalletID::GetMyCurrentTime(CString &time,bool flag)
{
	CTime tm; 
	tm=CTime::GetCurrentTime(); 
	if (flag)
	{
		time.Format(L"%d-%d-%d-%d-%d-%d",tm.GetYear(),tm.GetMonth(),tm.GetDay(),tm.GetHour(),tm.GetMinute(),tm.GetSecond());
	}
	else
	{
		int temp = tm.GetYear() / 1000;
		temp = tm.GetYear() - temp * 1000;
		time.Format(L"%02d%02d%02d",temp,tm.GetMonth(),tm.GetDay());
	}
}
开发者ID:HanoiGuo,项目名称:BoJay-SFIS,代码行数:15,代码来源:PalletID.cpp

示例10: InitControl

BOOL CDlgHistoryLogUser::InitControl()
{
	// 查询结果列表中需要显示的列包括了:开始时间、结束时间、摄像头名称、
	DWORD dwStyle;
	dwStyle = m_ListCtrl_UserLog.GetStyle();
	dwStyle = LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT;
	m_ListCtrl_UserLog.SetExtendedStyle(dwStyle);

	InitControlList();

	m_strNodeName = "全部用户";

//	m_ComboType.InsertString(0, "所有类型");
	m_ComboType.InsertString(0,"管理端操作");
	m_ComboType.InsertString(1,"客户端操作");
	m_ComboType.InsertString(2,"辅助管理端操作");
	m_ComboType.SetCurSel(0);

	m_ComboSubType.InsertString(0, "所有分类型");
	m_ComboSubType.SetCurSel(0);

	CTime	nowtime	= CTime::GetCurrentTime();
	CTime	StartTime(nowtime.GetYear(), nowtime.GetMonth(),nowtime.GetDay(), 0, 0, 0);
	CTime	StopTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 23, 59, 59);

	//开始时间初始化
	m_StartDay = StartTime;
	m_StartTime = StartTime;
	m_StopDay  = StopTime;
	m_StopTime  = StopTime;

	UpdateData(FALSE);

	return TRUE;
}
开发者ID:github188,项目名称:MonitorSystem,代码行数:35,代码来源:DlgHistoryLogUser.cpp

示例11: GetMyCurrentTime

void CShipment::GetMyCurrentTime(CString &time)
{
	CTime tm; 
	tm=CTime::GetCurrentTime(); 
	time.Format(L"%d-%d-%d-%d-%d-%d",tm.GetYear(),tm.GetMonth(),tm.GetDay(),tm.GetHour(),tm.GetMinute(),tm.GetSecond());

}
开发者ID:HanoiGuo,项目名称:BoJay-SFIS,代码行数:7,代码来源:Shipment.cpp

示例12: DebugPrintf2

void DebugPrintf2(int iRoomID, const char *p, ...)
{
	OutputDebugString("wx DebugPrintf2");
	/*if(!m_bWriteLog)
	{
	return ; 
	}*/
	return;
	char szFilename[1024];
	CString strPath = CINIFile::GetAppPath() +"\\GameLog\\";

	SHCreateDirectoryEx(NULL, strPath, NULL);

	CTime time = CTime::GetCurrentTime();

	sprintf(szFilename, "%s%d_%d-%d%d%d%d-log.txt",
		strPath , NAME_ID, iRoomID, time.GetYear(), time.GetMonth(), time.GetDay(),time.GetHour());
	FILE *fp = fopen( szFilename, "a" );
	if (NULL == fp)
	{
		return;
	}
	va_list arg;
	va_start( arg, p );
	vfprintf(fp, p, arg );
	fprintf(fp,"\n");
	fclose(fp);
}
开发者ID:liuwanbing,项目名称:liuwanbing,代码行数:28,代码来源:ServerManage.cpp

示例13: ParseStringToTime

BOOL CSkinSection::ParseStringToTime(const CString &str, CTime &tm)
{
	int nLen = str.GetLength();
	if ( nLen < 10)
		return FALSE;

	int nHead = -1;
	int nTail = -1;
	CTime tmNow = CTime::GetCurrentTime();
	int nVal[6] = {tmNow.GetYear(),tmNow.GetMonth(),tmNow.GetDay(),
					tmNow.GetHour(),tmNow.GetMinute(),tmNow.GetSecond()};
	
	for (int i=0; i<6; i++)
	{
		nHead = nTail + 1;
		nTail = str.Find(',',nHead + 1);
		
		if (nTail < 0)
			nTail = nLen;

		nVal[i] = atoi(str.Mid(nHead,nTail - nHead));
	}
	tm = CTime(nVal[0],nVal[1],nVal[2],nVal[3],nVal[4],nVal[5]);
	
	return TRUE;
}
开发者ID:smallfishincup,项目名称:biyesheji,代码行数:26,代码来源:SkinIniFile.cpp

示例14: CTimeToULong

unsigned long  CCommClass::CTimeToULong(CTime time)
{  
	
    int  days[13] = { 0, 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;
    int  day  , i ;
    unsigned long  seconds ;
    
    seconds =    0 ;
    day     =    0 ;
    
	bool bLeapYear = time.GetYear()%400 == 0 || ( time.GetYear()%4 == 0 && time.GetYear()%100 != 0 ) ;
    if( !bLeapYear )
        days[2] = 28 ;
    
    for( i = 0 ; i < ( time.GetYear()-2000 ) ; i++ )    
    {
		bLeapYear = (2000+i)%400 == 0 || ( (2000+i)%4 == 0 && (2000+i)%100 != 0 ) ;
        if( bLeapYear )
            day += 366 ;
        else
            day += 365 ;
    }    
    for( i = 1 ; i < time.GetMonth() ; i++ ) 
    {
        day += days[i] ;
    }       
    day += ( time.GetDay() - 1 );     
    
    seconds = ( day * 24 + time.GetHour() )*3600 + time.GetMinute() * 60 + time.GetSecond() ;
    return seconds ;    
}
开发者ID:shengang1978,项目名称:HH,代码行数:31,代码来源:CommClass.cpp

示例15:

CDate::CDate(CTime& t)
{
	m_day = t.GetDay();
	m_month = t.GetMonth();
	m_year = t.GetYear();
	m_xmlname = "date";
}
开发者ID:sverhagen,项目名称:trillian-bdc,代码行数:7,代码来源:Date.CPP


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