How to get system current date???

harry_qc 2002-09-21 10:11:17
How to get system current date???
...全文
50 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
harry_qc 2002-09-21
  • 打赏
  • 举报
回复
hei, I got it!
How about this way:
#include <time.h>
void main(){
char tmpbuf[128];
_strdate( tmpbuf );
cout<<tembuf<<endl;
}
mylove0618 2002-09-21
  • 打赏
  • 举报
回复
unsigned __cdecl _getsystime(struct tm *);
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
};
#include<time.h>


eg:
#include<stdio.h>
#include<time.h>
void main(){
tm t;
getsystime(&t);
printf("\nIt's %d---%d---%d today.",t.tm_year,t.tm_mon,t.tm_mday);
}
blh 2002-09-21
  • 打赏
  • 举报
回复
CInstance::SetDateTime
The SetDateTime method sets a datetime property.

bool SetDateTime(
LPCWSTR name,
const WBEMTime& wbemtime
);
Parameters
name
Name of the datetime property that is set.
wbemtime
Value assigned to the datetime property.
Return Values
Returns TRUE if the operation was successful and FALSE if an attempt was made to set a nonexistent or non-datetime property. More information is available in the log file, Framework.log.

Note The wbemtime parameter will be converted to local time, and any arbitrary offsets will be lost.

Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 SP4 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Instance.h; include FwCommon.h.
Library: Use Framedyn.lib.
harry_qc 2002-09-21
  • 打赏
  • 举报
回复
Do I need to write the Date function in my program?
how to use it?(in Visual C++)
#include <dos.h>
int main(){
Date ?????
}
mylove0618 2002-09-21
  • 打赏
  • 举报
回复
#include<dos.h> or #include<time.h>.tc环境中。
mylove0618 2002-09-21
  • 打赏
  • 举报
回复
void getdate(struct date *dateblk)
本函数将计算机内的日期写入结构dateblk中以供用户使用
日期贮存结构date
┌───────────────┐
│struct date │
│{ │
│ int da_year; /*自1900的年数*/│
│ char da_day; /*天数*/ │
│ char da_mon; /*月数 1=Jan*/ │
│} │
└───────────────┘

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧