本文整理汇总了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();
}
}
示例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();
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}
示例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());
}
}
示例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;
}
示例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());
}
示例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);
}
示例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;
}
示例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 ;
}
示例15:
CDate::CDate(CTime& t)
{
m_day = t.GetDay();
m_month = t.GetMonth();
m_year = t.GetYear();
m_xmlname = "date";
}