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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.