Solved

tm_wday

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
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 how to create, access, and change arrays in the C programming language.

810 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