如题,有没有API?
解决方案 »
- mfc 32位程序中,64位整数与字符串如何相互转换?
- 一个简单的调试问题
- 有没有熟悉CDataGrid这个类的,进来看下!
- Profile可以在分布式系统中使用吗?
- 状态栏显示?
- 编译错误,信息如下,什么意思,请指教
- 急急!用类向导出现问题
- 用mfc如何动态改变复选框的个数和标题
- 菜鸟提问!关于学习孙鑫的VC++视频第5课的难题。
- VB高手和API函数高手留下你的QQ号或EMAIL交过朋友吧。我的EMAIL:[email protected],QQ:402834
- 如何用 CPrintDialog 打印一个TXT文档 ??
- 程序点击退出按钮,会出现断言错误,有的第一次没出错误,退出主窗口再进又会出现错误,请有经验高手提示
LPSYSTEMTIME lpSystemTime
);SYSTEMTIME这个结构体里有星期几
int i = tm.GetDayOfWeek();
微软难道没有提供这样的API?
#include
char *name[] = { "Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
};
void main(){
int D,M,Y,A;
printf("Day: "); fflush(stdout);
scanf("%d",&D);
printf("Month: "); fflush(stdout);
scanf("%d",&M);
printf("Year: "); fflush(stdout);
scanf("%d",&Y);
/* January and February are treated as month 13 and 14, */
/* respectively, from the year before. */
if ((M == 1) || (M == 2)){
M += 12;
Y--;
}
A = (D + 2*M + 3*(M+1)/5 + Y + Y/4 - Y/100 + Y/400) % 7;
printf("It's a %s.\n",name[A]);
} /*一月和二月被当作前一年的*//*十三月和十四月分别处理*/
{
struct tm atm = {0};
atm.tm_mday = nDay;
atm.tm_mon = nMonth - 1;
atm.tm_year = nYear - 1900;
atm.tm_isdst = -1;
time_t t = mktime(&atm); return localtime(&t)->tm_wday + 1;
}帮你从MFC抄了一个,没做错误检测。
返回值和CTime的一样。
This method retrieves the day of the week based on local time; 1 = Sunday, 2 = Monday, ..., 7 = Saturday.
time=CTime::GetCurrentTime();
CString strDate=time.Format(%A,%B,%d,%Y,%H,%M,%S);
//分别表示为星期几,几月,几日,年,小时,分,秒
http://msdn2.microsoft.com/zh-CN/library/29btb3sw.aspx
{
struct tm atm = {0};
atm.tm_mday = nDay;
atm.tm_mon = nMonth - 1;
atm.tm_year = nYear - 1900;
atm.tm_isdst = -1;
time_t t = mktime(&atm); return localtime(&t)->tm_wday + 1;
}帮你从MFC抄了一个,没做错误检测。
返回值和CTime的一样。
This method retrieves the day of the week based on local time; 1 = Sunday, 2 = Monday, ..., 7 = Saturday.