Hi

How to get WeekdayName in VC++

I have searched on net and found the use of
CTime::GetCurrentTime();

But this is the lengthy method

Is there any shorter one.

Kindly advice

Regards
Karan

Hi Chris

For Example today is wednesday.

How can I get the Week day Name i.e. Sunday, Monday ... from VC++

Regards
Karan

oh the day of the week, my bad. Either way i'm sure you could have adapted the information given by that webpage it's not too complex.

#include <iostream>
#include <ctime>
#include <string>

using namespace std;

int main (void){
  time_t rawtime;
  struct tm * timeinfo;

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );
  string day(asctime (timeinfo));
  cout << "Date: " << day.substr(0, day.find_first_of(" "));
  
  cin.get();
  return 0;
}

Chris

This question has already been answered. Start a new discussion instead.