?
Solved

tm_wday

Posted on 1997-05-17
5
Medium Priority
?
1,558 Views
Last Modified: 2006-11-17
How do figure what day it is in a week ??
i want a func whitch gives me a number like 6 for sunday
or 0 as monday
asctime ????

Thanks superabbe@hotmail.com
0
Comment
Question by:superabbe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Author Comment

by:superabbe
ID: 1250456
sorry about the spelling
Its saturday and i'm having a good time !
0
 
LVL 2

Accepted Solution

by:
mlev earned 100 total points
ID: 1250457
struct tm *tp = localtime(time(NULL));
tp->tm_wday; /* Sunday = 0, Monday = 6 */
0
 
LVL 2

Expert Comment

by:mlev
ID: 1250458
Oops, sorry. More like this:
time_t t = time(NULL);
struct tm *tp = localtime(&t);
tp->tm_wday; /* Sunday = 0, Monday = 6 */
0
 

Author Comment

by:superabbe
ID: 1250459
But can I make this statement now ?

if (tm_wday==0)
        printf("sunday");

Thanks
/Abbe
0
 
LVL 2

Expert Comment

by:mlev
ID: 1250460
Almost...
if (tp->tm_wday == 0)
      printf("sunday");

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question