就是取今天星期几?

解决方案 »

  1.   

    UINT DayOfWeek[] = {
       LOCALE_SDAYNAME7,   // Sunday
       LOCALE_SDAYNAME1,   
       LOCALE_SDAYNAME2,
       LOCALE_SDAYNAME3,
       LOCALE_SDAYNAME4, 
       LOCALE_SDAYNAME5, 
       LOCALE_SDAYNAME6   // Saturday
    };TCHAR strWeekday[256];
    CTime time(CTime::GetCurrentTime());   // Initialize CTime with current time
    ::GetLocaleInfo(LOCALE_USER_DEFAULT,   // Get string for day of the week from system
       DayOfWeek[time.GetDayOfWeek()-1],   // Get day of week from CTime
       strWeekday, sizeof(strWeekday));TRACE("%s\n", strWeekday);               // Print out day of the week
      

  2.   

    UINT DayOfWeek[] = {
       LOCALE_SDAYNAME7,   // Sunday
       LOCALE_SDAYNAME1,   
       LOCALE_SDAYNAME2,
       LOCALE_SDAYNAME3,
       LOCALE_SDAYNAME4, 
       LOCALE_SDAYNAME5, 
       LOCALE_SDAYNAME6   // Saturday
    };TCHAR strWeekday[256];
    CTime time(CTime::GetCurrentTime());   // Initialize CTime with current time
    ::GetLocaleInfo(LOCALE_USER_DEFAULT,   // Get string for day of the week from system
       DayOfWeek[time.GetDayOfWeek()-1],   // Get day of week from CTime
       strWeekday, sizeof(strWeekday));TRACE("%s\n", strWeekday);               // Print out day of the week
      

  3.   

    VOID GetSystemTime(
      LPSYSTEMTIME lpSystemTime   // address of system time structure
    );typedef struct _SYSTEMTIME {  // st 
        WORD wYear; 
        WORD wMonth; 
        WORD wDayOfWeek; //你要的
        WORD wDay; 
        WORD wHour; 
        WORD wMinute; 
        WORD wSecond; 
        WORD wMilliseconds; 
    } SYSTEMTIME; wDayOfWeek 
    Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.