getting current day of the week

i am writing a simple program, and i need a command to get the current day of the week. I have tried looking for commands associated with time.h, but it seems they all get the time/date/year, and this is not what i want. prefferably i would like the command to get the abbreviated versions of the days.
ex: sun, mon, tue, wed, etc...

please help, i am hoping there is a simple answer i am overlooking.. i have tried looking on the forums, but i couldnt find anything addressing my problem.
gmtime() will give you a struct with a member named wday i think.
thank you! i found an answer to my problem, although somewhat lengthy i think... is there any way to do the same thing, only with fewer commands?
this what i found:


1
2
3
4
5
6
7
8
9
10
11
12
    const string DAY[]={"Sun","Mon","Tue",
    "Wed","Thu","Fri","Sat"};
    // i wish i could cut this out,
    // but apparently it is needed     
    // {
        time_t rawtime;
        tm * timeinfo;
        time(&rawtime);
        timeinfo=localtime(&rawtime);
    // }
    int wday=timeinfo->tm_wday;
    cout << "Today is: " << DAY[wday] << "\n" << endl;
Topic archived. No new replies allowed.