要包括年月日的,谢谢了

解决方案 »

  1.   

    方法很多: 
    SYSTEMTIME GetLocalTime, 或者time, 得到年月日,再sprintf即可
    还可以使用日期控件,再用Format方法.
      

  2.   

    函数名称:     asctime
    函数原型:     char* asctime(struct tm * ptr)
    函数功能:     得到机器时间(日期时间转换为ASCII码)
    函数返回:     返回的时间字符串格式为:星期,月,日,小时:分:秒,年
    参数说明:     结构指针ptr应通过函数localtime()和gmtime()得到
    所属文件:     <time.h>#include <stdio.h>
    #include <string.h>
    #include <time.h>
    int main()
    {
        struct tm t;
        char str[80];
        t.tm_sec=1;
        t.tm_min=3;
        t.tm_hour=7;
        t.tm_mday=22;
        t.tm_mon=11;
        t.tm_year=56;
        t.tm_wday=4;
        t.tm_yday=0;
        t.tm_isdst=0;
        strcpy(str,asctime(&t));
        printf("%s",str);
        return 0;
    }
      

  3.   

    SYSTEMTIME, GetLocalTime()
    年月日,小时,分,秒,星期几都有