Solved

tm_wday

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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 and use conditional statements in the C programming language.

790 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