Solved

tm_wday

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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…
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 reading files in the C programming language.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now