Solved

tm_wday

Posted on 1997-05-17
5
1,548 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 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

733 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