如题,怎么样在程序中调用系统的日期(年月日),
分不高,请大家帮个忙

解决方案 »

  1.   

    ???
    CTime tm;
    CString date;
    tm=CTime::GetCurrentTime();
    date.Format("%Y年%M月%D日");
    "%"后面有很多的,你自己试个52次就知道了,区分大小写
      

  2.   

    Example
    // Retrieves the current system date and time.  The system 
    // time is expressed in Coordinated Universal Time (UTC). 
    SYSTEMTIME systime;
    GetSystemTime(&systime);// Determine day of the week.
    CString day;
    switch (systime.wDayOfWeek)
    {
    case 0:
      day = "Sunday";
      break;case 1:
      day = "Monday";
      break;case 2:
      day = "Tuesday";
      break;case 3:
      day = "Wednesday";
      break;case 4:
      day = "Thursday";
      break;case 5:
      day = "Friday";
      break;case 6:
      day = "Saturday";
      break;
    }// Show the time in a message box.
    char str[50];
    wsprintf(str, "%s %u/%u/%u  %u:%u:%u:%u", 
      day,
      systime.wYear, systime.wMonth, systime.wDay,
      systime.wHour, systime.wMinute, systime.wSecond, systime.wMilliseconds);
    AfxMessageBox(str);